Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need a few header file namely curses.h for text based programming Please tell me how to install these header files.

share|improve this question

2 Answers 2

up vote 17 down vote accepted

You can install libncurses5-dev package via Software Center or:

sudo apt-get install libncurses5-dev

Also, you can install the package by clicking here.

When you need a file or package and can't find it you can use some tools.

1. apt-file

First, install apt-file and update it.

sudo apt-get install apt-file
apt-file update

You can search with apt-file needed files or packages.

apt-file search curses.h

2. Use packages.ubuntu.com

Go to this link.

On right top, select package contents if your are searching a file included with a package. If you need a package directly, just search it with its name choosing package names.

share|improve this answer
    
can you tell me what libncurses package contains? –  coder Nov 13 '11 at 8:49
    
please tell me how to get gtk.h –  coder Nov 13 '11 at 8:50
1  
@sharik, I edited my answer. Finding packages could be tricky, since when you search those files you can get lots of package names. You must know what you are looking for. Probably you need libgtk2.0-dev or libgtk-3-dev now. But, since you are using 11.10 first choose libgtk-3-dev one. If you have more questions, just edit your question to widen it. Do not ask one by one in your comments. –  heartsmagic Nov 13 '11 at 9:10
    
Holy crap I can't believe I have never heard of apt-file after using it for all these years. Thanks for the tip, awesome! –  xamox Feb 20 at 5:46

Find package from file

Edit: This only works for an installed package, so is not able to answer the question. Better is heartmagic's answer

To find out what package a file is part of, you can use

dpkg -S <file name>

For example, dpkg -S curses.h gives me this output:

libncurses5-dev: /usr/include/ncurses.h
libncurses5-dev: /usr/include/curses.h

Find files in package

Edit: You need to have the package installed for this to work.

To get the list of files provided by a package, use

 dpkg -L <package name>

For example dpkg -L libncurses5-dev gives me the following output

/.
/usr
/usr/include
/usr/include/curses.h
/usr/include/cursesapp.h
/usr/include/cursesf.h
/usr/include/cursesm.h
/usr/include/cursesp.h
/usr/include/cursesw.h
/usr/include/cursslk.h
/usr/include/eti.h
/usr/include/etip.h
/usr/include/form.h
/usr/include/menu.h
/usr/include/nc_tparm.h
/usr/include/ncurses_dll.h
/usr/include/panel.h
/usr/include/term.h
/usr/include/term_entry.h
/usr/include/termcap.h
/usr/include/tic.h
/usr/include/unctrl.h
/usr/lib
/usr/lib/libform.a
/usr/lib/libmenu.a
/usr/lib/libncurses++.a
/usr/lib/libncurses.a
/usr/lib/libpanel.a
/usr/lib/libtic.a
/usr/share
/usr/share/doc
/usr/share/doc/libncurses5-dev
/usr/share/doc/libncurses5-dev/copyright
/usr/share/doc/libncurses5-dev/changelog.Debian.gz
/usr/include/ncurses.h
/usr/lib/libncurses.so
/usr/lib/libtic.so
/usr/lib/libform.so
/usr/lib/libmenu.so
/usr/lib/libpanel.so
/usr/lib/libcurses.a
/usr/lib/libtermcap.a
/usr/lib/libtermcap.so
/usr/lib/libcurses.so

This includes directories as well.


Find ONLY files (not directories) in package

To get just the files the package contains:

dpkg -L libncurses5-dev | while read file; do if [[ -f $file ]]; then echo ${file}; fi; done

(Description: Get the provided files, and for each one, only print it if it is a file.)


More information

You might find this table useful. Just look at the first column (action) and third column (deb) to get a good overview of what you can do. (unless you are curious of course, then look at the other columns.)

share|improve this answer
    
This is a good info. But there is a small problem for this question. Since libncurses5-dev package is not installed and there is no curses.h on his system, he can't use to find the real package what provides this. But, besides that this is a good info. –  heartsmagic Nov 13 '11 at 18:54
    
@heartsmagic Thanks for pointing that out. I guess I have investigated Contents-i386,etc. (like in mirror.aarnet.edu.au/pub/ubuntu/archive/dists/oneiric ) and thought that it would use that, but actually it does not. –  Portablejim Nov 13 '11 at 21:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.