Boost环境配置及遇到的问题解决方案
2013-09-17 20:54
417 查看
1.模块/工具简介
Boost库是一个跨平台,开源并且完全免费的C++库,内容涵盖字符串处理、正则表达式、容器与数据结构、并发编程、函数式编程、泛型编程、设计模式实现等许多领域,使得实际的开发更加灵活和高效。(下载最新版的Boost库http://www.boost.org/ )
2.系统要求
Windows xp以上
3.部署步骤
(1)选择下载Boost库Windows版的安装包,解压至硬盘任意目录(建议硬盘根目录),下面用$BOOSTDIR表示boost的存放目录
(2)在解压的文件夹中找到bootstrap.bat并运行,生成bjam的可执行程序,运行即可
(3)编译完成后会生成bin.v2和stage子目录,里面包含了生成的*.lib库文件
(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:
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实际都是在这个目录下生成的
Boost库是一个跨平台,开源并且完全免费的C++库,内容涵盖字符串处理、正则表达式、容器与数据结构、并发编程、函数式编程、泛型编程、设计模式实现等许多领域,使得实际的开发更加灵活和高效。(下载最新版的Boost库http://www.boost.org/ )
2.系统要求
Windows xp以上
3.部署步骤
(1)选择下载Boost库Windows版的安装包,解压至硬盘任意目录(建议硬盘根目录),下面用$BOOSTDIR表示boost的存放目录
(2)在解压的文件夹中找到bootstrap.bat并运行,生成bjam的可执行程序,运行即可
(3)编译完成后会生成bin.v2和stage子目录,里面包含了生成的*.lib库文件
(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 |
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实际都是在这个目录下生成的
相关文章推荐
- Boost环境配置及遇到的问题解决方案
- Boost环境配置及遇到的问题解决方案
- Boost环境配置及遇到的问题解决方案
- hadoop环境配置过程中可能遇到问题的解决方案
- OSGi进阶环境配置遇到问题,我的解决方案
- 机会网络平台haggle在Ubuntu下的运行环境配置过程遇到问题的解决方案
- Python学习笔记·Sublime text3 配置Python编译环境时遇到的问题及解决方案
- hadoop环境配置过程中可能遇到问题的解决方案
- hadoop环境配置过程中可能遇到问题的解决方案
- hadoop环境配置过程中可能遇到问题的解决方案
- Hadoop环境配置过程中可能遇到问题的解决方案
- hadoop环境配置过程中可能遇到问题的解决方案
- Android环境配置时遇到问题及解决方案
- Redis介绍——Linux环境Redis安装全过程和遇到的问题及解决方案
- Xcode 8最近朋友的项目遇到了关于上架的问题以及xcode8所需要的环境的配置以及ios 10所支持的功能
- 环境配置问题与解决方案:VMWare 10 安装CentOS6.6 时自动进入text mode
- VS2012 + OpenCV2.4.9 + matlab2016b环境配置遇到的问题
- 配置android环境遇到的问题及解决办法
- 安装Tomcat,过程中需要配置的环境变量及遇到的问题
- 配置torch、nccl环境遇到的问题