今天学习了一些Linux 下的curses编程的内容, 编写了一个简单的curses程序:
#include <ncurses.h>
int main()
{
initscr() ; /*初始化, 进入NCURSES模式*/
printw("Hello world!!!\n"); /*在虚拟屏幕上打印Hello World!!!*/
refresh() ; /*将虚拟屏幕上的内容写到显示器上,并刷行*/
getch() ; /*等待用户的输入*/
endwin() ; /*退出NCURSES模式*/
return 0;
}
在编译的时候: gcc test.c -o test -lcurses 遇到下面的错误:
test:1: fatal error: curses.h: No such file or directory
在网上搜了一下,才发现原来是少安装了curses库,于是在新得立查找并安装了libncurses5-dev,安装了curses库,问题得以解决。