getch()
is part of the
NCURSES – New Curses[
^] library. You should add
-lncurses
to your link directive. If you are compiling/linking from the command line it would look like
gcc game.c -o game -lncurses
If you are using make then add
LDLIBS = -lncurses
to your Makefile, and if you are using an IDE, then look into the system documentation on how to add a library to the project.
I have not tried it, but I do not think
getch()
will work without using
initscr()
. Here's a simple "Hello World" program in C
#include <curses.h>
int main()
{
initscr();
mvprintw(5, 10, "Hello World!");
getch();
endwin();
return 0;
}
If you are going to continue with curses, then you should probably read one of the tutorials that you can google for.