LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   can you help me? (https://www.linuxquestions.org/questions/programming-9/can-you-help-me-19730/)

wwnn1 04-29-2002 06:29 AM

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!

Mik 04-29-2002 07:37 AM

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.