Boost logo

Boost Users :

Subject: Re: [Boost-users] msvc linker wants to prepend "lib" to library names
From: Andy Falanga (afalanga) (afalanga_at_[hidden])
Date: 2012-02-03 10:24:00

> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Lars Viklund
> Sent: Thursday, February 02, 2012 1:48 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] msvc linker wants to prepend "lib" to
> library names
> On Thu, Feb 02, 2012 at 12:30:10PM -0700, Nathan Currier wrote:
> > lib being added to the beginning of the library name represents
> linking
> > dynamically. In MS Visual Studio, you can change between Static and
> Dynamic
> > under Project / Properties / Configuration Properties / C/C++ / Code
> > Generation / Runtime Library. A setting of MD or MDd is Dynamic and
> MT or
> > MTd is Static, the appended 'd' representing debug capabilities. Try
> > swapping between the two types to see if it fixes the linking
> problem.
> Please do not top-post (as per guidelines).
> Your post is dangerously incorrect. There are two very distinct
> concepts
> at work here:
> 1) having a static or import+dynamic Boost library,
> 2) having a Boost library built against the static or dynamic C++
> runtime.
> A lib- prefix on Windows implies that the Boost library is a static
> library. The lack of the lib- prefix indicates that the library is an
> import library and has an associated DLL file.

Thank you for clarifying this one. The first response didn't fit what
I'd found on-line from many sources (to include

> What you describe is what the -s- tag indicates, namely whether the C++
> runtime library is statically or dynamically linked. The presence of -
> s-
> means that the static runtime is used. The lack of it means that the
> dynamic runtime is used.

I finally found the auto_link.hpp file but I admit that I don't fully
understand it. How does the system know to arrange for static over
dynamic linking? This was quite confusing to me. For the moment, the
problem is fixed with the inclusion of the macro BOOST_DYN_LINK in the
additions I've made to the solution.

For my own understanding, although we're making a DLL in this solution,
would we want to use static linking or dynamic? I think I realize that
the answer to this may possibly be, "It depends on your needs and that
of your customer." However, this discussion has come up on the team
since I've inadvertently "discovered" this issue. If you're making
a DLL, what would be the "preferred" or "best practice" approach for
linking with the Boost libraries?

For the record, it was the Boost documentation, in concert with other
postings online, that helped me to understand what was happening here.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at