Jump to content
  • Advertisement

Archived

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

KurtCPP

Using getch() under Linux.

This topic is 5453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
you need to link with the curses library.
add -lcurses to your makefile.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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".

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!