I have ran bjam.exe --build-dir="C:\build-boost" --build-type=minimal msvc stage
and now I have libraries .lib with these headers, for example
libboost_serialization-vc100-mt
libboost_serialization-vc100-mt-1_45
libboost_serialization-vc100-mt-gd
libboost_serialization-vc100-mt-gd-1_45
I believe these should be static libraries for debug and release version. When I run the compiler with Multi-threaded Debug (/MTd)
it gives an error LNK1104: cannot open file 'libboost_serialization-vc100-mt-sgd-1_45.lib'
It is looking for one with -sgd
where am i going wrong?
When the users runtime is dynamically linked the Boost libraries can be built either as dynamic libraries (. so's on Unix platforms, . dll's on Windows) or as static libraries (. a's on Unix, .
Whereas using a static library means every file in your program must have it's own copy of the library's files at compile-time. The downside of using a dynamic library is that a program is much more susceptible to breaking. If a dynamic library for example becomes corrupt, the executable file may no longer work.
The headers should be in /usr/local/include/boost and the libs should be in /usr/local/lib.
What are the differences between static and dynamic libraries? Static libraries, while reusable in multiple programs, are locked into a program at compile time. Dynamic, or shared libraries, on the other hand, exist as separate files outside of the executable file.
Something that is kind of confusing is there are two 'static' options for building boost with MSVC.
B2.exe takes the option link=static
which tells boost that you want to link it (boost) statically. If you are compiling your VC project with /MT or /MTd you will also need to use the runtime-link=static
option to tell boost that you will be linking to the VC runtime libraries statically.
It is the second runtime-link=static
which puts the -s in the .lib name.
My command line for building boost was
b2.exe --toolset=msvc variant=release link=static threading=multi runtime-link=static stage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With