赞
踩
Boost库是一个跨平台,开源并且完全免费的C++库,内容涵盖字符串处理、正则表达式、容器与数据结构、并发编程、函数式编程、泛型编程、设计模式实现等许多领域,使得实际的开发更加灵活和高效。(下载最新版的Boost库http://www.boost.org/ )
Windows xp以上
(4)配置vs环境,创建测试项目test,工具栏项目->右键->test属性->配置属性->C/C++->常规->附加包含目录中添加$BOOSTDIR路径(C:\boost_1_54_0;),在链接器->常规->附加库目录中添加$BOOSTDIR\stage\libs(C:\boost_1_54_0\stage\lib\*.lib),应用并确定,boost库在win32环境下就部署成功了!
4.可能遇到的问题
(1)LINK : fatal error LNK1104: cannot open file '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:
Key Use this library when: Boost.Build option s linking statically to the C++ standard library and compiler runtime support libraries. runtime-link=static g using debug versions of the standard and runtime support libraries. runtime-debugging=on y using a special debug build of Python. python-debugging=on d building a debug version of your code.7 variant=debug p using 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-type=complete msvc stage link=static
(2)Already defined in libcmt.lib
解决方案参加上一篇文章
附:VS2010 静态链接 Boost 函数库的配置方法:
打开项目属性->配置属性->C/C++->代码生成,选择“运行库”为“多线程 (/MT)”(如选择“多线程 DLL (/MD)”,则为动态链接 Boost 库)。
(3)想改变编译配置的话,在boost_1_54_0\tools\build\v2 中的 user-config.jam文件,bootstrap.bat和bjam实际都是在这个目录下生成的
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。