# C++ and ncurses



## macavenger (Dec 16, 2001)

I have been trying to write a relatively simple command line application which makes use of various ncurses functions. In the process I found that the copy of curses that came installed on OS X was lacking in many features. So I downloaded and installed (successfully) ncurses 5.2. Now whenever I try to compile my program, I get various undefined symbols errors (such as _move and _refresh), depending on what curses functions I use. I know it isn't a problem with my program, because it compiles fine using the built-in curses library. Not to mention that I get the errors even if I write a simple program with nothing but a single curses command, such as refresh(); or move(5,5); Does anyone have any idea as to what I can do about this or where I can go to get help? Thanks!


----------



## macavenger (Jan 2, 2002)

Anyone? Even for just who/where I should ask? Please? I would _really_ like to get this working!  thanks!

Macavenger


----------



## cgiard (Jan 10, 2002)

Try putting the following around the ncurses include files:

extern "C" {
#include <somefile.h>
};


----------



## macavenger (Jan 10, 2002)

Thanks for the reply . Didn't work though . Still giving me the same error. Thanks anyway!


----------



## howardm4 (Jan 13, 2002)

did you add:

-L/usr/local/lib -lncurses

to the compile/link command?


----------



## macavenger (Jan 13, 2002)

No, I hadn't (Was that something I should have known?) However, once again doing so produced no observable result. Still the same undefined symbols errors.


----------



## howardm4 (Jan 13, 2002)

you may have to run 'ranlib' on the libcurses.a to generate a table of contents


----------



## macavenger (Jan 15, 2002)

Done. Still no change. Perhaps someone who has installed and used this successfully (if anyone) could tell me exactly how/what they did? I have reinstalled it from several different sources in several different formats now, all with the same result. I'd think it was something with my system, except that the same thing happened when I tried it on a clean system...


----------



## macavenger (Jan 15, 2002)

Ok, turns out I needed to do both the ranlib command and -L/usr/local/lib -lncurses. Seems rather obvious from the posts now that I think about it, but for some reason I never tried it before. Now when I compile, however, I get a long list of unused multiple definitions warnings. Harmless, I know, but is there some way to get rid of them?


----------



## howardm4 (Jan 15, 2002)

clean up the code or ignore them.  The Apple linker is 
kind of 'noisy' that way.  Be thankful, in the 10.0 version, 
those were compiler fatal errors,not warnings.


----------



## macavenger (Jan 15, 2002)

Thank you very much for all your help!!


----------

