转载http://blog.csdn.net/isilent/article/details/7400359
从http://www.boost.org/上下载boost库,当前版本是1.52
boost_1_52_0\ .................The “boost root directory” index.htm .........A copy of www.boost.org starts here boost\ .........................All Boost Header files libs\ ............Tests, .cpps, docs, etc., by library index.html ........Library documentation starts here algorithm\ any\ array\ …more libraries… status\ .........................Boost-wide test suite tools\ ...........Utilities, e.g. Boost.Build, quickbook, bcp more\ ..........................Policy documents, etc. doc\ ...............A subset of all Boost library docs
boost的一部分库都是由hpp文件组成,因此可以直接引用,而无需编译。但也有一部分需要编译成二进制代码,为了今后方便,我们可以全部先编译一遍。
1. 运行bootstrap.bat,完毕后会生成bjam.exe
2. 运行bjam.exe,
bjam.exe --toolset=msvc-9.0 --link=static --runtime-link=shared --threading=multi --without-python stage debug release
这时应该根据自己的需要考虑是否进行完全编译,若完全编译的话,简单地执行命令 bjam --toolset=msvc-9.0 --build-type=complete 就可以了。(这里用的是VC2010)
#include <boost/timer.hpp> #include <iostream> using namespace boost; using namespace std; int main() { timer t; cout << t.elapsed_max() / 3600 << "h" << endl; getchar(); return 0; }