win8.1系统vs2013中boost 1.55.0的安装
来源:互联网 发布:什么软件看漫画免费 编辑:程序博客网 时间:2024/05/16 11:32
在使用vs2013编译boost-1.55.0之前,先要给boost做下修改:
boost_1_55_0\boost\intrusive\detail\has_member_function_callable_with.hpp line:222
template<class U>static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) <U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);替换成以下内容:
#ifdef BOOST_MSVC template<class U> static decltype(boost::move_detail::declval<Fun>().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME() , boost_intrusive_has_member_function_callable_with::yes_type()) Test(Fun*);#else template<class U> static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) <U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);#endif
1、管理员权限cmd中运行:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"编译32位
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat"编译64位
2、命令行进入boost所在目录,运行bootstrap.bat(我的64位没有执行步骤一出错)
3、32位编译:
主意要把换行符去掉:把命令复制到记事本去掉换行符
bjam.exe stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-serialization --without-wave --without-test --without-program_options --without-serialization --without-signals --stagedir=".\bin\vc12_x86" link=static runtime-link=shared threading=multi debug release
64位编译:
bjam.exe stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-serialization --without-wave --without-test --without-program_options --without-serialization --without-signals --stagedir=".\bin\vc12_x64" link=static runtime-link=shared threading=multi debug release address-model=644、添加boostest工程的包含目录和库目录
包含目录添加 D:\boost_1_55_0
库目录添加 D:\boost_1_55_0\stage\lib
具体如下图:
5、测试代码:
#include <boost/lexical_cast.hpp> #include <iostream> using namespace std;int main(){using boost::lexical_cast;int a = lexical_cast<int>("123");double b = lexical_cast<double>("123.0123456789");string s0 = lexical_cast<string>(a);string s1 = lexical_cast<string>(b);cout << "number: " << a << " " << b << endl;cout << "string: " << s0 << " " << s1 << endl;int c = 0;try{c = lexical_cast<int>("abcd");}catch (boost::bad_lexical_cast& e){cout << e.what() << endl;}system("pause");return 0;}结果:
Ubuntu中执行:
1. 设置执行属性: chmod 755 bootstrap.sh
2.执行(如果已经在当前目录) : ./bootstrap.sh
3.bjam
bjam命令参数分析
(1)stage/install:
stage表示只生成库(dll和lib),install还会生成包含头文件的include目录。本人推荐使用stage,因为install生成的这个include目录实际就是boost安装包解压缩后的boost目录(E:\SDK\boost\boost,只比include目录多几个非hpp文件,都很小),所以可以直接使用,而且不同的IDE都可以使用同一套头文件,这样既节省编译时间,也节省硬盘空间。
(2)toolset:
指定编译器,可选的如borland、gcc、msvc(VC6)、msvc-9.0(VS2008)等。
(3)without/with:
选择不编译/编译哪些库。因为python、mpi等库我都用不着,所以排除之。还有wave、graph、math、regex、test、program_options、serialization、signals这几个库编出的静态lib都非常大,所以不需要的也可以without掉。这可以根据各人需要进行选择,默认是全部编译。但是需要注意,如果选择编译python的话,是需要python语言支持的,应该到python官方主页http://www.python.org/下载安装。
查看boost包含库的命令是bjam --show-libraries。
(4)stagedir/prefix:
stage时使用stagedir,install时使用prefix,表示编译生成文件的路径。推荐给不同的IDE指定不同的目录,如VS2008对应的是E:\SDK\boost\bin\vc9,VC6对应的是E:\SDK\boost\bin\vc6,否则都生成到一个目录下面,难以管理。如果使用了install参数,那么还将生成头文件目录,vc9对应的就是E:\SDK\boost\bin\vc9\include\boost-1_46\boost,vc6类似(光这路径都这样累赘,还是使用stage好)。
(5)build-dir:
编译生成的中间文件的路径。这个本人这里没用到,默认就在根目录(E:\SDK\boost)下,目录名为bin.v2,等编译完成后可将这个目录全部删除(没用了),所以不需要去设置。
(6)link:
生成动态链接库/静态链接库。生成动态链接库需使用shared方式,生成静态链接库需使用static方式。一般boost库可能都是以static方式编译,因为最终发布程序带着boost的dll感觉会比较累赘。
(7)runtime-link:
动态/静态链接C/C++运行时库。同样有shared和static两种方式,这样runtime-link和link一共可以产生4种组合方式,各人可以根据自己的需要选择编译。
(8)threading:
单/多线程编译。一般都写多线程程序,当然要指定multi方式了;如果需要编写单线程程序,那么还需要编译单线程库,可以使用single方式。
(9)debug/release:
编译debug/release版本。一般都是程序的debug版本对应库的debug版本,所以两个都编译。
- win8.1系统vs2013中boost 1.55.0的安装
- win8.1+vs2013下安装CGAL(含qt、boost、cmake)
- win8.1+vs2013下安装CGAL(含qt、boost、cmake)
- win8.1+vs2013下安装CGAL(含qt、boost、cmake)
- win8.1+vs2013下安装CGAL(含qt、boost、cmake)
- CGAL(32)+Boost+CMake+win8.1+VS2013
- win8 64位 VS2013下boost库的编译
- VS2013中安装配置Boost库
- VS2013中安装、配置Boost库
- VS2013安装失败(win8.1)
- vs2013的boost安装及配置
- 安装系统-win8.1
- VS2013+Win8.1+CUDA7.0环境配置
- OpenCV3.0 + vs2013 +win8
- SQL2012在win8系统中安装出现的问题
- mrpt在win8.1 64bit + vs2013环境下的安装和编译
- 在win8.1系统VS2013环境配置OpenGL开发环境
- VS2013中安装配置和使用Boost库
- 动态设置控件大小位置
- Red and Black
- HDU 1754 I Hate It
- LeetCode:Implement strStr()
- android第三方登录以及第三方分享
- win8.1系统vs2013中boost 1.55.0的安装
- KMP算法
- 01背包(模板题) 之 poj 3624
- poj2262 Goldbach's Conjecture 素数的欧拉筛法
- 线程 同步 ConditionVariable-------特别使用在mediaplayer和camera多次调用中.
- 合并两个有序链表
- 山風蠱
- C语言实现的小项目 关机小程序
- 小白学jquery Mobile《构建跨平台APP:jQuery Mobile移动应用实战》连载三(整蛊小游戏)