I'm really confused here, here's what I think is a simplified model of my situation:
libMyLibrary2.a
has references to libMyLibrary1.a
. If I link like this:
gcc -shared dummy.cpp.o -o libOutput.so -L/path/to/libs -lMyLibrary1 -lMyLibrary2
I get a whole bunch of undefined reference to
errors. But if I link like this:
gcc -shared dummy.cpp.o -o libOutput.so -L/path/to/libs -lMyLibrary1 /path/to/libs/libMyLibrary2.a
Everything's okay. Is this normal? Or should it have something to do with my specific settings? In reality I have numerous libraries in place of MyLibrary1 and MyLibrary2 and also many flags. Or is it the case that I'm missing something else, maybe some key difference between the commands? I can post the exact commands that do and don't work if required.