我有静态或动态 boost 库吗?
我已经运行了 bjam.exe --build-dir="C:uild-boost" --build-type=minimal msvc stage
现在我有带有这些头文件的库 .lib,例如
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
我相信这些应该是用于调试和发布版本的静态库.当我使用 Multi-threaded Debug (/MTd)
运行编译器时,它给出错误 LNK1104: cannot open file 'libboost_serialization-vc100-mt-sgd-1_45.lib'
它正在寻找一个 -sgd
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
我哪里出错了?
推荐答案
有点令人困惑的是,使用 MSVC 构建 boost 有两个静态"选项.
Something that is kind of confusing is there are two 'static' options for building boost with MSVC.
B2.exe 采用选项 link=static
,它告诉 boost 您想要静态链接 IT.如果您使用/MT 或/MTd 编译您的 VC 项目,您还需要使用 runtime-link=static
选项来告诉 boost 您将静态链接到 VC 运行时库.
B2.exe takes the option link=static
which tells boost that you want to link IT 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.
第二个 runtime-link=static
将 -s 放在 .lib 名称中.
It is the second runtime-link=static
which puts the -s in the .lib name.
我用于构建 boost 的命令行是
My command line for building boost was
b2.exe --toolset=msvc variant=release link=static threading=multi runtime-link=static stage
相关文章