1. Download and download the latest boost version. Unable to connect to SF, so I found another address.
2. You do not need to compile most of the boost libraries. You only need to include the header files. The boost libraries that need to be compiled separately are as follows:
- Boost. filesystem
- Boost. graphparallel
- Boost. iostreams
- Boost. MPI
- Boost. programoptions
- Boost. Python (see the boost. Python
Build documentation before building and installing it)
- Boost. RegEx
- Boost. serialization
- Boost. Signals
- Boost. System
- Boost. Thread
- Boost. Wave
You can select to compile a small part of the Library:
- Boost. datetime has a binary component that is only needed if you're
Using itsTo_string/From_stringOr serialization features, or if you're targeting visual c ++ 6.x or Borland.
- Boost. graph also has a binary component that is only needed if you
Intend to parse graphviz files.
- Boost. Math has binary components for the tr1 and c99 cmath functions.
- Boost. Random has a binary component which is only needed if you're
UsingRandom_device.
- Boost. test can be used in "header-only" or "separately compiled" mode,
AlthoughSeparate compilation is recommended for serious use.
3.compilation Step 1. Run bootstrap.batin the boostroot directory to compile and generate bjam.exe 2. using bjam to compile the boost library, execute the command: bjam -- toolset = msvc-9.0 -- Build-type = complete above the command fully compiled, will generate multiple versions of boost library, it took me an hour and a half to select a part of the version to bjam stage -- stagedir = "vc9" toolset = msvc-9.0 threading = multi variant = release. The libraries generated after debug compilation are in the vc9 directory, compile the intermediate file in Bin. v2 Directory, which can be deleted. Refer to the official instructions and refer to the official instructions for renewal. 5. about boost's auto-Link Mechanism (from the http://blog.csdn.net/cay22/article/details/4873468), when using boost, you don't need to specify the library to be linked, boost's auto-Link Mechanism will automatically help us include the corresponding static Lib. That is to say, boost is linked in static mode by default, so our project property should also be set to multi-threaded (Debug ). If you want to use DLL Dynamic Link, you need to define the macro in advance:
# Define boost_all_dyn_link
Similarly, boost will include the corresponding lib by default. If you do not want to use the auto-Link Mechanism provided by boost, or do not feel at ease with its automatic link (in fact, you do not have to worry about it), you can define the macro in advance:
# Define boost_all_no_lib
Use the following link:
# Pragma comment (Lib, "boost_thread-vc90-mt-1_39.lib ")
Or
# Pragma comment (Lib, "boost_thread-vc90-mt.lib ")
The two lib libraries are actually the same. I really don't understand why each library needs to be copied during boost compilation. Is it because the latter does not need to change the code after upgrading the boost version? There is also a useful macro:
# Define boost_lib_diagnostic
It allows VC to specify the boost Library and the link sequence in the output window during compilation.
For details about the auto-Link Mechanism of boost, you can refer to the Code in boost/config/auto_link.hpp, which is easy to understand and worth learning.