I have a libX.a that I've created (from test.c) and put in /usr/lib/
I've then created another libY.a, that calls functions in libX.a, I've also copied this lib to /usr/lib/
Now when I write a program that uses both these libs, then compile I get:
test.c header files exist in /usr/include/ and I've compiled with -lX -lY, but its not working...
bill@micosoftsux:~$ gcc test_prog.c -Wall -m32 -O -g -lX -lY -o test_prog
/usr/lib/libY.a(test.c.o): In function `test_init':
test.c:(.text+0x111): undefined reference to `test_open'
test.c:(.text+0x237): undefined reference to `test_open'
/usr/lib/libY.a(test.c.o): In function `test_send':
test.c:(.text+0x7e3): undefined reference to `test_write'
test.c:(.text+0x8fc): undefined reference to `test_write'
collect2: ld returned 1 exit status
make: *** [test_prog] Error 1
test_open and test_write are in libX?
You could try something like "gcc -lX -lY -lX -lY <the rest of that stuff>" as it is a library processing issue -- there are three phases to the linking. If you don't include the second reference, phase two dies because of dependencies.
Firt specify -lY and then -lX:
Originally Posted by coletek
Or use shared libraries :)
bill@micosoftsux:~$ gcc test_prog.c -Wall -m32 -O -g -lY -lX -o test_prog
I remember now, having the same problem in Windows, so this is definitely GCC specific, not shared object / Linux.