在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 保存。 在運(yùn)行Developer Command Prompt for VS2013(路徑Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat),
進(jìn)入boost所在目錄,運(yùn)行bootstrap.bat; ./b2 ,
會(huì)在stage/lib目錄下生成lib庫文件.這個(gè)命令在32位和64位都可以運(yùn)行。
也可以用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環(huán)境下編譯得先從開始菜單啟動(dòng)Visual Studio 2013的vs2013 x64兼容工具命令行,而不是隨便打開任意一個(gè)命令行窗口就行。
然后轉(zhuǎn)到boost根文件夾,運(yùn)行bootstrap.bat生成x64版的bjam.exe。
然后運(yùn)行命令: 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
命令行選項(xiàng)詳解:
stage/install: stage表示只生成庫(dll和lib),install還會(huì)生成包含頭文件的include目錄。推薦使用stage。
toolset: 指定編譯器,可選的如borland、gcc、msvc(VC6)、msvc-12.0(VS2013)等。
without/with: 選擇不編譯/編譯哪些庫。因?yàn)閙pi等庫我都用不著,所以排除之。
wave、graph、math、regex、test、program_options、serialization、signals這幾個(gè)庫編出的靜態(tài)lib都非常大,所以不需要的也可以without掉。
這可以根據(jù)各人需要選擇,默認(rèn)是全部編譯。如果選擇編譯python的話,是需要python語言支持的,應(yīng)該到python官方主頁http://www.python.org/下載安裝。
stagedir/prefix: stage時(shí)使用stagedir,install時(shí)使用prefix,表示編譯生成文件的路徑。
link: 生成動(dòng)態(tài)鏈接庫/靜態(tài)鏈接庫。生成動(dòng)態(tài)鏈接庫需使用shared方式,生成靜態(tài)鏈接庫需使用static方式。一般boost庫可能都是以static方式編譯,因?yàn)樽罱K發(fā)布程序帶著boost的dll感覺會(huì)比較累贅。
runtime-link: 動(dòng)態(tài)/靜態(tài)鏈接C/C++運(yùn)行時(shí)庫。同樣有shared和static兩種方式,這樣runtime-link和link一共可以產(chǎn)生4種組合方式,各人可以根據(jù)自己的需要選擇編譯。
一般link只選static的話,只需要編譯2種組合即可,即link=static runtime-link=shared和link=static runtime-link=static。
threading: 單/多線程編譯。一般都寫多線程程序,當(dāng)然要指定multi方式了;如果需要編寫單線程程序,那么還需要編譯單線程庫,可以使用single方式。
debug/release: 編譯debug/release版本。一般都是程序的debug版本對(duì)應(yīng)庫的debug版本,所以兩個(gè)都編譯