I wanted to try out the Boost::Serialization library for a project I'm working on. I'm also trying to get used to programming in Linux as well. I set up boost in its default locations. I tried compiling the test file they provide here with the command line arguments they provide and it worked fine. In this example they use the .a file.
Then I went to the Serialization page and tried running one of the serialization demos. I ran basically the same commands, except I swapped out the file names and linked against libboost_serialization.a instead of libboost_regex.a, but I got a bunch of errors. After playing with different options and double checking the directories I finally got it to work by replacing the .a with the .so file.
Just for reference, what finally worked for me was this:
g++ /usr/local/lib/libboost_serialization.so sertest.cpp -o sertest
How come for one example I linked against the .a file, and in the other I had to link against the .so?
Because when linking statically, the order in which you specify the libraries and object files does matter. Specifically, a library must be mentioned after object files that use symbols from it.