Boost version: boost_000052_0
Ubuntu: ubuntu-12.04.1-desktop-i386
There are two installation methods:
==================
First:
It is also the simplest: Enter
# Apt-cache search boost
You will see a lot of file information, and you will see a file called libboost-dev, you can directly install this file:
# Apt-get install libboost-dev
The installation is successful. This speed is very fast because the lib file is directly copied to the system.
You can use the final code in this article to test whether the installation is successful or not.
====================
Second:
This is slow because you need to compile the lib library by yourself.
First download the boost library from the website www.boost.org to download the linux boost library in two formats: 1). bz2 2). gz
I ended with gz. Put it in the linux File System. Assume It is/usr/local/boost_1_52_0.tar.gz.
Step 1: Decompress the compressed package. The command is as follows (# is used only as the starting flag and is ignored when you press the command ):
# Cd/usr/local/
# Tar-zxvf boost_000052_0.tar.gz
Step 2: Decompress the package and obtain the folder boost_000052_0. Run the following command:
# Cd boost_000052_0/
#./Bootstrap. sh // This command is similar to configuring the environment
Step 3: run the two-step command to get a file named bjam. Run this file:
#./Bjam // it may take a dozen minutes to complete the installation.
Step 4: Check whether the installation is successful: Create test. cpp in any directory in linux
# Include <iostream>
# Include <boost/lexical_cast.hpp>
// Using namespace std;
// Using namespace boost;
Int main ()
{
Int a = boost: lexical_cast <int> ("123456 ");
Std: cout <a <std: endl;
Return 0;
}
This is a simple program for converting strings into integers.
Run the following command:
# G ++ test. cpp-o test
#./Test
The output result is 123456.
It means that boost is successfully installed, so you can enjoy boost !!!