在Linux上编译代码时,遇到以下错误信息: curses.h:No such file or directory 查阅相关资料,整理了下解决方案: 在Debian/ Ubuntu Linux系统中,我们可以使用以下命令来安装ncurses: $ sudo apt-get install libncurses5-dev libncursesw5-dev 而我使用的是 CentOS版本的Linux,其解决办法有点不一样,具体是,在RHEL / Fedora / CentOS Linux中,我们使用以下命令: # yum install ncurses-devel ncurses 安装过程大致如下: [root@localhost test]# yum install ncurses-devel ncurses Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons:centos.ustc.edu.cn * base:centos.ustc.edu.cn * commercial-addons:elastix.adaptixnetworks.com * elastix-base:elastix.adaptixnetworks.com * elastix-extras:elastix.adaptixnetworks.com * elastix-updates:elastix.adaptixnetworks.com * epel:mirrors.neusoft.edu.cn * extras:ftp.sjtu.edu.cn * updates: centos.ustc.edu.cn Excluding Packages from CentOS-5 - Addons Finished Excluding Packages from CentOS-5 - Base Finished Excluding Packages from CentOS-5 - Extras Finished Excluding Packages from CentOS-5 - Updates Finished Setting up Install Process Package ncurses-5.5-24.20060715.i386 already installed andlatest version Resolving Dependencies --> Running transaction check ---> Package ncurses-devel.i386 0:5.5-24.20060715 set tobe updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: ncurses-devel i386 5.5-24.20060715 base 1.6 M Transaction Summary ================================================================================ Install 1Package(s) Upgrade 0Package(s) Total download size: 1.6 M Is this ok [y/N]: y Downloading Packages: ncurses-devel-5.5-24.20060715.i386.rpm | 1.6 MB 00:01 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : ncurses-devel 1/1 Installed: ncurses-devel.i3860:5.5-24.20060715 Complete! 安装完成后,重新编译程序,一切正常!