im trying to compile some c++ code that uses a stub library i wrote. The library is written in C and has a header and a few functions that do nothing. In my makefile i compile the library with
gcc -Wall -Werror -c myLib.c -o myLib.o
gcc -shared -nostartfiles -Wl,-soname,libmyLib.so -o libmyLib.so myLib.o
The library seems to build fine, running ld -lmyLib --verbose
finds the library and shows all the functions. Note: is does give a warning:
cannot find entry symbol _start; not setting start address
Then in my other code I compile and link seperately. I compile with
g++ -Wall -Werror -c foo.o foo.cpp -lmyLib
This compiles fine, foo.cpp contains #include<myLib.h>
and myLib.h is in /usr/include/
When i try to link it all together with
g++ -o mainProg *.o -lmyLib
i get the errors "undefined reference to (functions in mylib)"
I have tried to figure this out for a few days but have had no luck. Is there something silly I am missing?
Thanks and let me know if theres any more info I can give.