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 a开发者_如何学编程nd 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?
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
You have the dynamic versions. The static ones are delimited by having the "s" in the name. Make sure you specified link=static
on the bjam
command line. If not, you'll have to rebuild to make the static versions.
See Boost getting started windows section 6.3 naming and section 6.1 on Unix naming
For static libraries there should be a s in there e.g. -sgd so you have dynamic libraries
here is how i break it down
libboost_serialization-vc100-mt-sgd-1_45.lib
lib- if boost library starts with lib then its a static library , shared library do not start with lib prefix. Also static library will have a '-s' in the name.
mt- multi-threaded , obtained by specifying threading=multi when you ran bjam or b2.This is the default threading.
g- use debug libraries for building the code
d- build a debug version of your code
So your compiler is searching for multi-threaded static debug library(mt-sgd) as you ran with /MTd(Creates a debug multithreaded executable file using LIBCMTD.lib). I guess by default it must be searching for static library. If you want a dynamic library, insert these lines in your code or define a macro
#define BOOST_ALL_DYN_LINK
Please check this document: http://www.boost.org/doc/libs/1_45_0/more/getting_started/windows.html#library-naming
There you can find the meanings of all letters and how you can build the boost accordingly also...
精彩评论