1. download the latest boost
Http://www.boost.org/
2. decompress the file
Tar-xzvf boost_1_45_0.tar.gz
3. Compile bjam
Go to the boost_cmd45_0 directory and run./Bootstrap. Sh. Then, you will get a bjam
4. Compile boost
. /Bjam -- with-date_time -- With-System -- With-RegEx -- With-thread -- With-filesystem -- With-serialization -- With-iostreams -- With-math -- With-MPI -- with-program_options -- -Python -- With-math -- With-signals -- layout = tagged install variant = debug, release link = static
-- Runtime-link = static threading = multi stage
5. View boost
After compilation, the latest boost header file is available in/usr/local/include/boost, and The. A library file compiled in/usr/local/lib is available.
Although both usr/local/include and/usr/include have directories, GCC first accesses/usr/local/include. After compilation, boost can be used by default.
6. Test boost
VI testboost. cpp
# Include <iostream>
# Include <boost/version. HPP>
Int main ()
{
STD: cout <boost_version <STD: Endl;
Return 0;
}
Compile: G ++-O testboost. cpp