Reproduced http://blog.csdn.net/isilent/article/details/7400359
1. Download boost
SlaveHttp://www.boost.org/DownloadBoostLibrary. The current version is1.52
Boost_000052_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
2. Compile
Some libraries of Boost are composed of HPP files, so they can be referenced directly without compilation. However, some of them need to be compiled into binaryCodeFor future convenience, we can compile it all first.
1. RunBootstrap.bat. bjam.exe will be generated after completion.
2. RunBjam.exe,
Bjam.exe -- toolset = msvc-9.0 -- link = static -- runtime-link = shared -- threading = multi -- without-Python stage debug release
In this case, you should consider whether to fully compile based on your own needs. If it is fully compiled, simply execute the commandBjam -- toolset = msvc-9.0 -- Build-type = complete.(Vc2010 is used here)
3. Add boost to the code library. The boost directory is the header file, and the stage \ Lib is the static Link Library. Copy it to the code library as needed. If it is only used on the local machine, you can also directly set the include and additional library directories in. , Output code
# 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 ;}