tags:

views:

276

answers:

3

I'm learning C and playing with the ncurses lib. I have seen references to both -lcurses and -lncurses but I have yet to find any differences (both work when compiling).

Appreciate the help!

A: 

On my system (Slackware64 13.0), libcurses.so and friends are just symbolic links to the ncurses equivalent, so there is no difference. The libcurses.so (-lcurses) name is probably just to provide backwards compatibility with code designed for other systems which have a curses implementation other than ncurses.

Michael E
A: 

On my (fedora 11) PC /usr/lib/libcurses.so contains: "INPUT(-lncurses)". I think it means that the two form (-lcurses, -lncurses) is equivalent.

sambowry
+7  A: 

ncurses is an open-source clone of the original Unix curses library. libcurses.* usually points to libncurses.* to provide compatibility with the original library, so there would be no practical difference between using one over the other.

If you do in fact have more than one 'curses-type' library installed, -lcurses would essentially link your program to the default one, whereas -lncurses would explicitly choose the ncurses implementation.

goldPseudo
On systems such as Solaris, the libcurses.so is the original (Unix) curses library (or an enhanced curses library, but not the GNU libncurses library). On Linux systems, there is no difference.
Jonathan Leffler