Problems with the ncurses library...

Korv

Registered
Sorry for the title, couldn't think of a better one,
anyway my problem is that when I run this program :

Code:
#include <stdio.h>
#include <ncurses.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>

int main (void) {
 initscr ();
 endwin ();
 return 0;
}

I this happens:

Code:
ZeroLink: unknown symbol '_initscr'

testncurses has exited due to signal 6 (SIGABRT).

I use Mac OS 10.3 compiled with GCC 3 (using Xcode as a comand line tool) and it compile with out warnings or errors , I'm really confussed since I never had this happen when I made programs with ncurses for my linux.
 
That's a linker error. It's trying to find the code for that routine but can't. You need to add /usr/lib/libncurses.dylib to your project.

Wade
 
should I add it like an include? since if I do it goes on forever when I try to compile it....
 
I managed to add ncurses.dylib now both in sources and framework & libarys but the same thing still happens :(
 
if I compile it with xcode I get that message with the zerolink and aborted but if I compile it using gcc main.c -o test -ansi -pedantic -Wall -l ncurses it works fine.... what am I doing wrong when I try to do it with xcode?
 
All you should have to do is choose Project->Add Files and add it to the project.

Attempt a build and then choose "Show Detailed Build Results" from the build menu. At the bottom of the window is a little dimple. Drag that up to expose the command-line output. Copy and paste that command-line output here.

Wade
 
Native Build of Target "testncurses"

CompileC build/testncurses.build/testncurses.build/Objects-normal/ppc/main.o main.c normal ppc c com.apple.compilers.gcc.3_3
cd /Users/jol/testncurses
/usr/bin/gcc-3.3 -x c -arch ppc -pipe -Wno-trigraphs -fasm-blocks -fpascal-strings -g -O0 -mtune=G4 -Wno-four-char-constants -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -O0 -fmessage-length=0 -ffix-and-continue -fzero-link -F/Users/jol/testncurses/build -I/Users/jol/testncurses/build/include -I/Users/jol/testncurses/build/testncurses.build/testncurses.build/DerivedSources -Wp,-header-mapfile,/Users/jol/testncurses/build/testncurses.build/testncurses.build/testncurses.hmap -c /Users/jol/testncurses/main.c -o /Users/jol/testncurses/build/testncurses.build/testncurses.build/Objects-normal/ppc/main.o

Building ZeroLink launcher /Users/jol/testncurses/build/testncurses
cd /Users/jol/testncurses
/usr/bin/ld -o /Users/jol/testncurses/build/testncurses -lcrt1.o /System/Library/PrivateFrameworks/ZeroLink.framework/Resources/libZeroLinkAppStub.a -all_load -lSystem -L/Users/jol/testncurses/build -L/Developer/SDKs/MacOSX10.3.0.sdk/usr/lib -L/Users/jol/testncurses -F/Users/jol/testncurses/build -stack_size 100000 -stack_addr c0000000 -framework ZeroLink -F/System/Library/PrivateFrameworks/ -x -unexported_symbols_list /System/Library/PrivateFrameworks/ZeroLink.framework/Versions/A/Resources/ZeroLinkAppStub.nexp -sectcreate __TEXT __zerolink /Users/jol/testncurses/build/testncurses.build/testncurses.build/Objects-normal/testncurses.zerolink

Bundlizing /Users/jol/testncurses/build/testncurses.build/testncurses.build/Objects-normal/ppc/main.ob /Users/jol/testncurses/build/testncurses.build/testncurses.build/Objects-normal/ppc/main.o




is that it?
 
Yep. Apparantly you still have not added it to your project correctly. Notice that there's no -lncurses. That should definitely be there if it were in your project correctly.

Delete libncurses.dylib from your project, use "Add Files to project", navigate to /usr/lib, add libncurses.dylib to your project and make sure it is included in the correct targets.

Wade
 
I can't find the file anymore.... did delite on the both others and now I can't find the orginal file... even did a find on them...
 
Uh, when you delete files from project builder, choose "Delete References" NOT "delete references and files". Use my profile to email me and I'll send you a copy of the files again. If you like, I'll also create a quick project that uses ncurses.

Wade
 
Back
Top