Linux程序设计中的curses.h编译报错,无法找到curses.h和ncurses.h

源程序screen.c如下:

#include <stdio.h>
#include <term.h>
#include <curses.h>
#include <stdlib.h>
 
int main()
{
    setupterm("unlisted", fileno(stdout), (int *)0);
    printf("Done. ");
    exit(0);
}
 
执行编译gcc -o badterm badterm.c -lcurses后报错情报如下:
term.h: 没有那个文件或目录
curses.h: 没有那个文件或目录
很明显,程序找不到term.h和curses.h,那么为了安装这两个头文件,就在shell中执行sudo apt-get install libncurses5-dev,之后再执行上述编译命令即可。
 
原文地址:https://www.cnblogs.com/linguoguo/p/3269639.html