Not able to compile C/C++ code that's using ncurses -


i've discovered ncurses , have started learning it, examples in tutorial don't compile on computer.

i had install ncurses manually , did entering "apt-get install libncurses5-dev libncursesw5-dev". had because before having done got error saying not "#include ".

installing worked, error instead:

touzen@comp:~/learning_ncurses$ g++ -o hello_world hello_world.cpp /tmp/ccubzbvk.o: in function `main': hello_world.cpp:(.text+0xa): undefined reference `initscr' hello_world.cpp:(.text+0x16): undefined reference `printw' hello_world.cpp:(.text+0x1b): undefined reference `refresh' hello_world.cpp:(.text+0x20): undefined reference `stdscr' hello_world.cpp:(.text+0x28): undefined reference `wgetch' hello_world.cpp:(.text+0x2d): undefined reference `endwin' collect2: ld returned 1 exit status 

the code compiled looks this:

#include <ncurses.h> int main(){     initscr();     printw("hai thar world...");     refresh();     getch();     endwin();      return 0; } 

why error. , more importantly, how fix this?

you have link ncurses library

g++ -o hello_world hello_world.cpp -lncurses 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -