Reputation: 180944
I'm writing an application that uses ncurses.
In Debian and Ubuntu, I have the choice between these packages:
The w
version includes wide-char support, which is what I want.
However, if I only install libndursesw5-dev
, I get an error message when I compile with -lncurses
or -lncursesw
where it tells me it can't find curses.h
or ncurses.h
.
Installing both libncurses5-dev
and libncursesw5-dev
and using -lncursesw
works, but I'm not sure if that is the proper way or just coincidentially seems to work. Using -lncurses
will bring in a non-wide-char library.
For reference, on Mac OS X 10.11, -lncurses
works (with wide-char support) and -lncursesw
doesn't work at all.
Upvotes: 0
Views: 2323
Reputation: 54505
Debian installs the two headers
/usr/include/curses.h
/usr/include/ncursesw/curses.h
as a workaround for compatibility. The latter is "mostly" compatible, but only at compile-time. For instance the WINDOW
structure is larger in the latter. The first (/usr/include/curses.h
) is "standard", but preceded the ncursesw library by several years. Because some of the platforms to which ncurses was ported do not use ncurses as the system curses library (e.g., Solaris), provision was made for putting ncurses' header in a subdirectory to avoid overwriting (or conflicting with) the system's standard curses.h
(see the ncurses FAQ Is the ncurses library compatible with my system?).
Since Debian started with ncurses as the system curses library, its packagers chose to use the same workaround to avoid conflict between ncurses and ncursesw. Packagers on some other systems could choose to put both in subdirectories and make a link in their packaging scripts like
/usr/include/curses -> /usr/include/curses/ncurses.h
I recall that Cygwin did something like that, and omitted the link for unctrl.h
(a bug, because it too is a standard header).
For OSX, the system provides only ncurses (not ncursesw), and most people using ncursesw do this via something like MacPorts, which installs the ncursesw header (which works well enough if the application defines _XOPEN_SOURCE_EXTENDED
when compiling for ncursesw,
since the declaration of WINDOW
is ifdef'd to allow either library to be supported). The Debian packagers were more cautious and chose to keep the headers separate.
Upvotes: 2