在vs2010下编译boost

1. 解压缩后,运行bootstrap.bat批处理文件,得到bjam.exe;
2. 在vs2010下编译boost
boost最新版本已经支持vs2010,然而直接下载编译会发现一堆bug;


首先由bootstrap编译bjam的时候就会碰钉子,典型的错误就是:


Failed to build Boost.Jam build engine.
Please consult bjam.log for furter diagnostics.


查看bjam.log后可以发现里面的错误信息:


command.c : fatal error C1033: cannot open program database ''


Technorati 标签: boost,c++,编译,vs2010
这个问题在于一个vs编译环境。默认我们都直接进入cmd进行编译,在vs2010环境下这个是行不通的。


其次的错误就是通过bjam编译boost库的时候,会发现编译过程中出现很多fatal,很多库编译不成功;


解决办法: 在开始菜单中,Microsoft Visual Studio 2010Visual Studio Tools下运行Visual Studio Command Prompt (2010),通过这个cmd进入boost的目录进行bjam的编译以及运行bjam编译boost;


搞定bjam后,在Visual Studio Command Prompt (2010)下直接运行:


bjam --toolset=msvc-10.0 --with-date_time --with-program_options --with-system --with-thread --with-filesystem --with-test --with-regex --with-crypto --with-serialization


然后就可以去喝咖啡了


具体编译参数详见:http://sswflying.spaces.live.com/blog/cns!A1AF9E41EDCAEF99!515.entry
原文地址:https://www.cnblogs.com/vcerror/p/4289054.html