我正在尝试开始在 Linux 上使用 ncurses 开发程序。我什至无法编译 Hello World 示例。这是代码:
#include <curses.h>
int main()
{
initscr();
printw("Hello, world.");
refresh();
getch();
endwin();
return 0;
}
当我尝试编译时,我得到:
hello.c:(.text+0x12): undefined reference to `initscr'
对于每一个被调用的函数。
我通过 apt-get 安装了 ncurses,也通过下载源代码和编译、安装等方式安装了 ncurses。
我都试过#include
了curses.h
和ncurses.h
。
到底是怎么回事?