在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版本,所以兩個都編譯