can you help me?
I have a programme below:
************* filename: a.c *************** #include<curses.h> main() { initscr(); ........ ........ /* other code */ } ******************************************* then I input the command: gcc a.c there are a lot of errors like this: undefined reference to 'initscr' But the file "curses.h" is included in '/usr/include', and,the procedure 'initscr()' is declared in file 'curses.h' this way: extern NCURSES_EXPORT(WINDOW *) initscr(void); Why this error happens? How can I correct it? My email is: wwnn1_class@sina.com Thanks! |
You need to link the curses library. Try compiling with the following command:
gcc -o programname code.c -lcurses Usually curses is just a link to ncurses so if that doesn't work try ncurses instead. |
All times are GMT -5. The time now is 12:28 PM. |