Adapt > Engage > Dominate

Library Linking in Linux

While installing a more recent version of Boost on Ubuntu, I came across a rather frustrating behavior.  When specifying the name of the library, whether it’s through the command line or the IDE (in my case, Eclipse), when specifying the name of the library and using the -l argument (=search for library), you need to drop the “lib” prefix of the library’s filename and the suffix (.a, .so).  If you don’t, the compiler whines that it can’t find the library.  Why is this, you ask?  Well, apparently, the -l switch automatically adds “lib” to the name of the library you are searching for.

After I discovered this, I saw that the install page on Boost did mention this, but I missed it somehow.  Small things like this are what made me rage when trying to develop on Linux before.  Once you know about these little things, it makes sense and everything works, but if you don’t know, you want to /slit  :-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: