Linking against libraries
Linking against libraries
- Subject: Linking against libraries
- From: Marvin Jones <email@hidden>
- Date: Tue, 17 Aug 2004 20:04:50 +0100
I'm new to XCode and have been trying to figure out how to link an
external library with a simple piece of C code using XCode (instead of
a good old makefile; don't ask me why). For some reason I am finding
this simple task problematic.
I have a library, say libutil.a, in /usr/local/lib and its header file,
say util.h, in /usr/local/include. I also have a simple piece of C
code, say main.c, in ~/, which is the main file in an XCode standard
tool project.
A simple makefile such as
main: main.o
gcc main.o -lutil -o main
main.o: main.c
gcc -c main.c
works fine from the command line and the command "make main" produces a
working executable, which does the right thing.
However, when the same C code is put into an XCode standard tool and
built the linker cannot find the library. I have tried to customize the
build settings by changing the entries in the Styles pane of the
Project Info inspector (I tried changing Header Search Paths to
/usr/local/include/, Liibrary Search Paths to /usr/local/lib/, Library
Style to static, and Other Linker Flags to -lutil), but to no avail.
When I tried to build with these settings XCode simply crashed! I've
also spent hours trying to get the relevant information out of the
XCode Documentation, but apple seems to want to tell me about
everything that XCode can do; everything that is apart from how to link
a simple standard C tool with my own libraries.
Can anyone help? It's probably a simple one, but I would appreciate a
helping hand.
Many Thanks, Marvin A. Beginner
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.