简体   繁体   中英

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

im having problem when compiling C++ source code. that code is a keylogger. at first, i save with .cpp, and try to compile it from terminal using this command

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. installed from terminal, and the copy that keylogger source code to code:::blocks. but the IDE shows this message

||=== 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. Can someone help me to fix this?

First of all, conio.h and windows.h these headers are not supported on linux console.

Alternative is to use NCurses library. It does all the Console realted stuff you could want and is part of the Linux Standard Base ( ie available in every distro ).

Include 'ncurses.h' instead.

I hope this will resolve your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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