Benjamin

静以修身,俭以养德,非澹薄无以明志,非宁静无以致远。
随笔 - 386, 文章 - 0, 评论 - 196, 引用 - 0
数据加载中……

win8+vs2013编译boost_1_55_0

在boost-1_55\boost\intrusive\detail\has_member_function_callable_with.hpp文件下,找到
struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_,BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
{
   template static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*);

 添加如下代码:
 #ifdef BOOST_MSVC template static decltype( boost::move_detail::declval().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME() ,boost_intrusive_has_member_function_callable_with::yes_type()) Test(Fun*);
 #else template static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*); #endif 保存。 在运行Developer Command Prompt for VS2013(路径Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat),
 
 进入boost所在目录,运行bootstrap.bat; ./b2 ,
 会在stage/lib目录下生成lib库文件.这个命令在32位和64位都可以运行。
 也可以用bjam.exe stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --without-math --without-mpi
 --without-serialization --without-wave --without-atomic --without-chrono --without-random --without-regex
 --without-test --without-thread --without-program_options --without-serialization --without-signals --stagedir=".\bin\vc12_x86"
  link=static runtime-link=shared threading=multi debug release命令编译 64位编译:
 
  x64环境下编译得先从开始菜单启动Visual Studio 2013的vs2013 x64兼容工具命令行,而不是随便打开任意一个命令行窗口就行。
  然后转到boost根文件夹,运行bootstrap.bat生成x64版的bjam.exe。
  然后运行命令: bjam.exe stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-serialization
  --without-wave --without-atomic --without-chrono --without-random --without-regex --without-test --without-thread
   --without-program_options --without-serialization --without-signals --stagedir=".\bin\vc12_x64"
   link=static runtime-link=shared threading=multi debug release address-model=64
   命令行选项详解:
   stage/install: stage表示只生成库(dll和lib),install还会生成包含头文件的include目录。推荐使用stage。
   toolset: 指定编译器,可选的如borland、gcc、msvc(VC6)、msvc-12.0(VS2013)等。
   without/with: 选择不编译/编译哪些库。因为mpi等库我都用不着,所以排除之。
   wave、graph、math、regex、test、program_options、serialization、signals这几个库编出的静态lib都非常大,所以不需要的也可以without掉。
        这可以根据各人需要选择,默认是全部编译。如果选择编译python的话,是需要python语言支持的,应该到python官方主页http://www.python.org/下载安装。
   stagedir/prefix: stage时使用stagedir,install时使用prefix,表示编译生成文件的路径。
   link: 生成动态链接库/静态链接库。生成动态链接库需使用shared方式,生成静态链接库需使用static方式。一般boost库可能都是以static方式编译,因为最终发布程序带着boost的dll感觉会比较累赘。
   runtime-link: 动态/静态链接C/C++运行时库。同样有shared和static两种方式,这样runtime-link和link一共可以产生4种组合方式,各人可以根据自己的需要选择编译。
        一般link只选static的话,只需要编译2种组合即可,即link=static runtime-link=shared和link=static runtime-link=static。
   threading: 单/多线程编译。一般都写多线程程序,当然要指定multi方式了;如果需要编写单线程程序,那么还需要编译单线程库,可以使用single方式。
   debug/release: 编译debug/release版本。一般都是程序的debug版本对应库的debug版本,所以两个都编译

posted on 2014-04-10 13:04 Benjamin 阅读(1999) 评论(0)  编辑 收藏 引用 所属分类: VC


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理