I have a simple static library, and a directory containing a test
program (on Mac OS X).
The make run is as follows:
make libfoo.a
cc -W -Wall -O2 -c -o messagebuffer.o messagebuffer.c
libtool -static -o libfoo.a messagebuffer.o
cd test; make test
cc -W -Wall -O2 -I.. -c -o main.o main.c
main.c: In function `main':
main.c:5: warning: unused variable `mb'
cc -W -Wall -o test ../libfoo.a main.o
ld: Undefined symbols:
_newMessageBuffer
make[1]: *** [test] Error 1
make: *** [test] Error 2
So libfoo.a DOES contain newMessageBuffer, because that function
is defined in messagebuffer.[ch], and disassembly shows that's
indeed there.
Even "cc -o bla libfoo.a test/main.o" gives the same ld error.
Any ideas?

Signature
XML is a prime example of retarded innovation.
-- Erik Meijer and Peter Drayton, Microsoft Corporation
Ulrich Hobelmann - 30 Jul 2005 16:43 GMT
> I have a simple static library, and a directory containing a test
> program (on Mac OS X).
[quoted text clipped - 8 lines]
> main.c:5: warning: unused variable `mb'
> cc -W -Wall -o test ../libfoo.a main.o
^ That was probably wrong, but the following doesn't work either:
cc -W -Wall -L.. -o test -lfoo main.o
ld: Undefined symbols:
_newMessageBuffer
make[1]: *** [test] Error 1
make: *** [test] Error 2

Signature
XML is a prime example of retarded innovation.
-- Erik Meijer and Peter Drayton, Microsoft Corporation
Paul Pluzhnikov - 30 Jul 2005 16:54 GMT
> Even "cc -o bla libfoo.a test/main.o" gives the same ld error. Any
> ideas?
Both of your link lines are incorrect. The correct link line is:
cc -W -Wall -o test main.o ../libfoo.a
Explanation:
http://webpages.charter.net/ppluzhnikov/linker.html
Cheers,

Signature
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.