I have been building a static library on Linux. So far it is purely self contained and all code inside does not use anything other than the standard library. I have recently made a change and now some compilation units are using boost code. I have been building the library using the following:
g++ -c -Wall -pedantic *.cpp
ar -cvq libbfclass.a *.o
My question is this: is it necessary for me to adapt this method to deal with the use of the new libraries or will I just need to provide the link library when building the executable that uses my own library? From what I understand a static library is basically just an archive of object files, but I was wondering if I need to modify my build scripts in order to make everything work as it should, or if it is only necessary when building executables???
You are correct – a static library is just an archive of object files. Symbols are resolved when you compile the final executable, so that’s when you need to provide the references to the other libraries.