主要参考文章:配置boost
下面是我在安装步骤以及遇到的问题(已解决):
一、下载boost_1_55_0,解压至D:\boost_1_55_0
二、在用VS2013编译boost_1_55_0之前,先给boost做一下修改:
打开boost_1_55_0\boost\intrusive\detail\has_member_function_callable_with.hpp
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
三、编译boost_1_55_0。启动“VS2013开发人员命令提示”,进入boost的解压目录,即D:\boost_1_55_0,输入bootstrap,便在根目录下生成bjam.exe文件。具体命令如下:
>D:\
>cd D:\boost_1_55_0\boost_1_55_0
>bootstrap.bat
遇到的问题:
(1).很无奈啊,一开始居然找不到"VS2013开发人员命令提示"在哪里,按照MSDN上将的,在“搜索”中输入Visual Studio Tools,然后选择VS2013开发人员命令提示。但是,我连Visual Studio Tools都没搜到,只看到2010版本的,2013的好像没有自己冒出来。。。好在最后在C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts中找到。
(2)打开"VS2013开发人员命令提示后",上面提示"cannot determine the location of the vs common tools folder",于是打开VC/bin目录下的vcvars32.bat,发现没有找到环境变量VS120COMNTOOLS。但是,我明明添加了VS120COMNTOOLS这个环境变量。为什么VS识别不出VS120COMNTOOLS?然后又是各种找答案。。。最后在stackoverflow上找到了解决方案,
(3)直接运行bootstrap不成功。
四、在命令提示行中继续运行bjam.exe,运行命令如下:
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=64
这个步骤大概花了十多分钟。
五、在VS工程属性——配置属性——VC++目录中,“包含目录”包含进boost目录,库目录包含进lib目录。