Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Static Linking Woes
From: Thomas Berg (merlin66b_at_[hidden])
Date: 2008-11-12 17:42:41


On Wed, Nov 12, 2008 at 10:33 PM, Brian Dawn <azan00_at_[hidden]> wrote:
> Hello everyone,
> I am sorry, I did not explain my situation as well as I should have. I have
> a complete build of boost installed so I had assumed it created static
> libraries alongside dynamic ones. When I received the "Mixing a dll boost
> library with a static runtime is a really bad idea..." message I had assumed
> autolink was to blame because I had assumed it would recognize the static
> install and thus search for the static libraries. When I disabled autolink I
> directly linked to "libboost_whatever.lib" as those are the static libraries
> correct? However that's when I received the heap corruption.
>
> As for the macros... I checked my user & config files, and
> BOOST_ALL_DYN_LINK was commented out.
>
>>> That suggests a build problem somewhere: do you still have
>>> BOOST_ALL_DYN_LIB
> defined or something?
>
> By still, do you mean that it is defined by default? Because I had never
> undefined it.
>
> Does boost complete build both static and dynamic libraries? Because maybe
> that is my problem.
>
> I appreciate everyone's help.
> Thanks,
> -Brian.
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

The boost libraries are usually linked against the shared C++ runtime
(compiled with /MD), unless you explicitly specify something else with
bjam. Your application should be linked to the same version of the C++
runtime.

If you really want to link your application against the static runtime
(compile with /MT) I guess you have to build boost with this flag too.
IIRC it is done by specifying runtime-link=static to bjam when
building boost. Did you do this yet?

After doing this, I guess there is some "magic" preprocessor define
you need to specify in your project, so the boost config header
becomes aware of what boost variant you are using...

Hope this helps,
Thomas


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