Linux Error: curses.h: No such file or directory Problem Solution

by on July 31, 2008 · 11 comments· LAST UPDATED July 31, 2008

in , ,

Q. I see following error when I run make command to install specific software:

curses.h: No such file or directory Problem Solution

How do I fix this error under Red Hat Enterprise Linux (RHEL) or CentOS / Fedora Linux?

A.. You need to install the curses library which include routines for a terminal-independent method of updating character screens with reasonable optimization. The ncurses (new curses) library is a freely distributable replacement for the
discontinued 4.4 BSD classic curses library.

Fix this error under RHEL / Fedora / CentOS Linux

Type the following command at a shell prompt as root user:
# yum install ncurses-devel ncurses
Sample output:

Loading "downloadonly" plugin
Loading "rhnplugin" plugin
Loading "security" plugin
rhel-x86_64-server-vt-5   100% |=========================| 1.2 kB    00:00
rhel-x86_64-server-5      100% |=========================| 1.2 kB    00:00
Setting up Install Process
Parsing package install arguments
Package ncurses - 5.5-24.20060715.x86_64 is already installed.
Package ncurses - 5.5-24.20060715.i386 is already installed.
Resolving Dependencies
--> Running transaction check
---> Package ncurses-devel.x86_64 0:5.5-24.20060715 set to be updated
---> Package ncurses-devel.i386 0:5.5-24.20060715 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 ncurses-devel           x86_64     5.5-24.20060715  rhel-x86_64-server-5  1.7 M
 ncurses-devel           i386       5.5-24.20060715  rhel-x86_64-server-5  1.6 M
Transaction Summary
=============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 3.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): ncurses-devel-5.5- 100% |=========================| 1.6 MB    00:01
(2/2): ncurses-devel-5.5- 100% |=========================| 1.7 MB    00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: ncurses-devel                ######################### [1/2]
  Installing: ncurses-devel                ######################### [2/2]
Installed: ncurses-devel.x86_64 0:5.5-24.20060715 ncurses-devel.i386 0:5.5-24.20060715
Complete!

Fix this error under Debian / Ubuntu Linux

Open terminal and type the following command to install ncurses:
$ sudo apt-get install libncurses5-dev libncursesw5-dev
Now you should able to compile any program under Linux.



If you would like to be kept up to date with our posts, you can follow us on Twitter, Facebook, Google+, or even by subscribing to our RSS Feed.


{ 11 comments… read them below or add one }

1 Mike March 3, 2010 at 3:34 am

cool thanks

Reply

2 bobo June 25, 2010 at 10:18 pm

Thanks! It helps me a lot.

Reply

3 rootnet47 March 18, 2011 at 6:53 am

I installed libncursesw5-dev in ubuntu by using
$ sudo apt-get install libncurses5-dev libncursesw5-dev
command and also checked in synaptic package manager but I’m still facing the same problem when I’m going to compile in gcc.

Reply

4 Edward April 17, 2012 at 12:21 am

Well, maybe you forgot to add “-lncurses” at the end of command.
Like this:
gcc -o game main.c -lncurses

I hope this may help you.

Reply

5 Edward April 17, 2012 at 6:23 am

Oh! Perhaps the setings of curses on your computer hadn’t been set to use ncurses lib automaticly. You may use ” ls -l /usr/include/curses.h” to check this. If curses.h is not a link to ncurses.h (or ncurses.h is not a link to curses.h), you need to add ” -I /usr/include/ncurses ” to use lib ncurses forcely.

Reply

6 stone September 9, 2011 at 7:20 am

cool, thanks

Reply

7 Parker September 12, 2011 at 4:22 pm

Thanks buddy…

Reply

8 Krishna Pandey April 26, 2012 at 1:55 pm

Thanks Pal, I was installing cscope on RHEL 6, on which I had ncurses package installed already. ncurses-devel package did the magic.

Reply

9 Akshay October 1, 2012 at 5:33 pm

Thanks for the help!

Reply

10 Edwin Jose May 7, 2013 at 6:01 pm

When I’m trying this “sudo apt-get install libncurses5-dev libncursesw5-dev”
the follwoing error occur;

Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libncruses5-dev
E: Unable to locate package libncrusesw5-dev

Reply

11 Edward May 22, 2013 at 11:36 am

You can use “apt-cache search ncurses ncursesw” to find out what the exactly name.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: