Ubuntu under Boost compilation install boost install 1. Dependent installation
- apt-get install mpi-default-dev libicu-dev python-dev python3-Dev libbz2-Dev zlib1g-Dev
2. Visit the Boost website to download the latest Boost version 3. Unzip the download file, e.g. download the file under ~/downloads
- CD ~/downloads
- Tar--bzip2-xvf boost_1_58_0. Tar. bz2
4. Prepare for installation
- CD boost_1_58
- ./Bootstrap. SH
Generate Files B2 and Bjam compute md5sum Find Them consistent
To generate the Bjam, the above command can be provided with various options, specifically refer to the Help documentation:./bootstrap.sh--help. Where the –prefix parameter, you can specify the installation path, if not with the –prefix parameter (recommended), the default path is/usr/local/include and/usr/local/lib, respectively, storing the header files and various libraries. Once executed, Bjam will be generated and the existing script will be automatically backed up. Note that boost 1.49 will generate two files in the current directory Bjam and B2, both of which are the same
5. Compile and install boost
Once the compilation is complete, install the header file and the generated library into the specified path (–prefix)
- . /B2//compile Boost
- Sudo. /b2 Install/ /Install the generated library to the/usr/local/lib directory, the default header file under the /usr/local/include/boost directory.
6. Uninstall
Delete the files in the/usr/local/lib and/usr/local/include/boost two directories directly.
7. Test whether the installation is correct
New CPP File
- vim boot.cpp
- #include <string>
- #include <iostream>
- #include <boost/version.hpp>
- #include <boost/timer.hpp>
- using namespace STD;
- int main()
- {
- Boost::timer T;
- cout << " Max TimeSpan: " << T.elapsed_max ()/3600 << " h " << Endl;
- cout << " min TimeSpan: " << t.elapsed_min () << "s" << endl;
- cout << " Now time elapsed: " << t.elapsed () << "s" << endl;
- cout << "Boost version" << boost_version <<endl;
- cout << "boost lib version" << boost_lib_version <<endl;
- return 0;
- }
Compile
- g+ + boot. Cpp-o Boot
- ./Boot
Results are displayed after successful compilation, and the last two lines print the boost version
- Max TimeSpan: 2.56205e+09H
- min TimeSpan: 1e-06S
- Now time elapsed: 0.000121S
- Boost version106300
- Boost Lib Version1_63
Ubuntu under Boost compilation installation