我有静态或动态 boost 库吗? [英] Do i have static or dynamic boost libraries?

查看:31
本文介绍了我有静态或动态 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

这篇关于我有静态或动态 boost 库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆