#### Archived

This topic is now archived and is closed to further replies.

# Using getch() under Linux.

## Recommended Posts

Hi every-1. I''m currently kinda forced to move to Linux to code my C++ and so I have to get used to program with ''only'' Linux text-editors and GCC (which are for those who don''t know few ergonomic but really powerful tools as soon as you''re able to master them). Not that it''s a bad thing but it seems that conio.h doesn''t exist anymore there. According to man getch, I gotta use curses.h. But in fact, neither does curses.h work. Here are the messages I get from the console :
thimof@er056:/mnt/tournedix/users/info1/thimof/Junk\$ g++ test.cpp -o test
/tmp/cc8UKvJ9.o(.text+0x1f): In function main'':
: référence indéfinie vers « stdscr »
/tmp/cc8UKvJ9.o(.text+0x25): In function main'':
: référence indéfinie vers « wgetch »
collect2: ld returned 1 exit status

Could someone Prog, Hex & Rock''n''Roll : I don''t like the Prog but the Prog likes me. Some nice poetry to sweeten your spirit and relax a bit before programming

##### Share on other sites
you need to link with the curses library.

##### Share on other sites
I may be a ignorant but I think asking is more intelligent than staying in one''s ignorance, then :
what exactly do you call makefil??
Is it merely the command line or need I type something else?
Thank you for your help. :-)

Prog, Hex & Rock''n''Roll :
I don''t like the Prog but the Prog likes me.
Some nice poetry to sweeten your spirit and relax a bit before programming

##### Share on other sites
oh, sorry, i just assumed that you were using a makefile
you can just add it to the command line:

g++ test.cpp -lcurses -o test

a makefile is basically instructions to the compiler/linker how to build your project. If you write a makefile, then you dont have to repeat the above command line every time you want to compile, instead you simply type "make".

• ### Forum Statistics

• Total Topics
628383
• Total Posts
2982368

• 10
• 9
• 15
• 24
• 11