Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2005-03-07 08:50:46


> Then someone in the list indicated I at least needed to indicate I want to
> link regex library, and "-l" was indicated for that purpose:
>
> c++ -I$PATH1/include/boost-1_32 -L$PATH1/lib -llibboost_regex-gcc
> credit_card_example.o -o memo

I'm surprised that this works, you normally need to to place the list of
libraries *after* the object files that use them: that's probably why
the -static option failed.

> When I read the documentation for "-l" I found "The linker searches a
> standard list of directories for the library, which is actually a file
> named liblibrary.a. The linker then uses this file as if it had been
> specified precisely by name.", so I'm confused why the dynamic library is
> being used... Any ways, I used -static, and it didn't work when it should
> ("On systems that support dynamic linking, this prevents linking with the
> shared libraries").

The linker always links to a shared library in preference to a static one
when there's a choice.

> Besides this static/dynamic problem, I'm wondering why I need to specify
> the boost libraries to use (that's not required for std libraries at all).
> If one requires several boost libraries, then are all them to be specified
> as well?

Yes, gcc will only link to those libraries that are always required (the C
and C++ runtimes), optional system libraries (-lpthread, -lm, -lrt etc) and
all third party libraries need to be explicitly listed,

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net