VS2010 boost 使用问题一例

最近有一个VS2010的工程用到了boost库,编译的时候报下面的错误:

>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-s-1_52.lib'

到boost库目录: ~boost_1_52_0\stage\lib 下一看,果然没有这个库,只有 libboost_thread-vc100-mt-gd-1_52.lib 与 libboost_thread-vc100-mt-1_52.lib。

那这个 'libboost_thread-vc100-mt-s-1_52.lib' 跟libboost_thread-vc100-mt-1_52.lib 有何差别呢?

-s

ABI tag: encodes details that affect the library's interoperability with other compiled code. For each such feature, a single letter is added to the tag:

KeyUse this library when:Boost.Build option
slinking statically to the C++ standard library and compiler runtime support libraries.runtime-link=static
gusing debug versions of the standard and runtime support libraries.runtime-debugging=on
yusing a special debug build of Python.python-debugging=on
dbuilding a debug version of your code.7 variant=debug
pusing the STLPort standard library rather than the default one supplied with your compiler.stdlib=stlport

For example, if you build a debug version of your code for use with debug versions of the static runtime library and the STLPort standard library in “native iostreams” mode, the tag would be:-sgdpn. If none of the above apply, the ABI tag is ommitted.

原来,-s 代表 “runtime-link-static",我的工程是用这种方式使用boost库的,因此需要'libboost_thread-vc100-mt-s-1_52.lib'

于是重新编译boost库,用下面的编译命令:

b2 --build-dir=c:\boost-build --build-type=complete msvc stage link=static

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值