I have this C code:
#include <curses.h>
int main(){
initscr();
move(10,30);
printf("Hola");
return 0;
}
I get this error:
main.C:(.text+0xf): undefined refernce to 'initfscr'
main.C:(.text+0x23): undefined refernce to 'move'
The command gcc
is:
gcc main.c -o main.exe
I have installed it using the MinGW installer. How can I solve this problem?.
I've tried uninstalling and reinstalling it but it doesn't work.
Update:
I have also linked my project with the frag of -lncurses
and I get the same problems:
gcc -lncurses main.c -o main.exe
When you import certain libraries in C you have to specify a specific flag to indicate to the compiler that you are making use of other libraries ( linker ), in the case of curses.h you have to specify that you are using that library with the flag
-lncurses
a Sometimes it appears as-lcurses
such that your build command should beAnd for a library with debugging is used
-lncurses_g
or-lcurses_g
be the case