简体   繁体   English

Code::Blocks 和 C++ 编译器问题。 无法编译头文件

[英]Code::Blocks, and C++ Compiler problem. cant compile a header

im having problem when compiling C++ source code.我在编译 C++ 源代码时遇到问题。 that code is a keylogger.该代码是一个键盘记录器。 at first, i save with .cpp, and try to compile it from terminal using this command首先,我用 .cpp 保存,并尝试使用此命令从终端编译它

g++ test.cpp

and then the terminal showed me this messages然后终端向我展示了这个消息

test.cpp:1:10: fatal error: conio.h: No such file or directory
#include <conio.h>
         ^~~~~~~~~
compilation terminated.

and this message和这个消息

test.cpp:2:10: fatal error: windows.h: No such file or directory
#include <windows.h>
         ^~~~~~~~~~~
compilation terminated.

to fix this, i tried to use a C++ IDE, code::blocks.为了解决这个问题,我尝试使用 C++ IDE,code::blocks。 installed from terminal, and the copy that keylogger source code to code:::blocks.从终端安装,并将键盘记录器源代码复制到 code:::blocks。 but the IDE shows this message但 IDE 显示此消息

||=== Build file: Debug in Belajar CPP (compiler: GNU GCC Compiler) ===|
/home/lucky/test.cpp|1|fatal error: conio.h: No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

I just don't know how to fix this and how to search the solutions online.我只是不知道如何解决这个问题以及如何在线搜索解决方案。 because I'm new in using Linux-Mint.因为我是使用 Linux-Mint 的新手。 Can someone help me to fix this?有人可以帮我解决这个问题吗?

First of all, conio.h and windows.h these headers are not supported on linux console.首先,Linux 控制台不支持 conio.h 和 windows.h 这些头文件。

Alternative is to use NCurses library.替代方法是使用 NCurses 库。 It does all the Console realted stuff you could want and is part of the Linux Standard Base ( ie available in every distro ).它可以完成您可能想要的所有与控制台相关的东西,并且是 Linux 标准库的一部分(即在每个发行版中都可用)。

Include 'ncurses.h' instead.改为包含“ncurses.h”。

I hope this will resolve your issue.我希望这将解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM