First, preface
The boost library is a portable, source-code C + + library that is backed up as a standard library and is one of the development engines of the C + + standardization process. The boost library is sponsored by the C + + Standards Committee Library team, and some of them are expected to become the next generation C + + standard library content. In the C + + community is very influential, is the absolute "quasi" standard library. Boost due to its emphasis on cross-platform, the emphasis on standard C + + is independent of the authoring platform. Most of the boost library features need to include only the corresponding header files, and a few (such as regular expression libraries, file system libraries, etc.) require a link library. But there are a lot of things that are experimental in boost, and they need to be cautious in practical development.
--------------------------------------------------------------------------------------
Second, boost installation 2.1 Boost website download boost Latest version 1.610
2.2 Unzip the download package to a local
After decompression, you can see a bootstrap.bat file under the folder. 2.3 Open cmd Command window, run Bootstra.bat file
Execute the following command, depending on your environment, with a slight change.
The main purpose is that we want to run the Bootstrap.bat file
After execution, the results are as follows:
And then under the folder we'll find a new file named Bjam.exe.
2.4 Run the Bjam.exe file in the cmd window
This process will by default compile the appropriate Lib files, header files, and so on, based on the compiled tools (vs2008,2010,2012,2013) that the system has already installed.
After compiling, the following is done:
At this point, the Boost library installation completes 2.5 configuration VS2010
Create a new Boosttest project file, add test code
<span style= "FONT-SIZE:14PX;"
> #include <boost/lexical_cast.hpp> #include <iostream> using namespace std;
int main () {using Boost::lexical_cast;
int a = lexical_cast<int> ("123");
Double b = lexical_cast<double> ("123.0123456789");
String s0 = Lexical_cast<string> (a);
string S1 = lexical_cast<string> (b);
cout << "Number:" << a << "<< b << Endl;
cout << "string:" << s0 << "<< s1 << Endl;
int c = 0;
try{C = lexical_cast<int> ("ABCD");
} catch (boost::bad_lexical_cast& e) {cout << e.what () << Endl;
} return 0; }</span>
Re-view property page (VS2010 here to find the relevant property configuration bar)->c/c++, add or edit boost file path in the attached include directory, mine is:
A:\Program\boost_1_61_0
Add the Boost library lib file path under the?> Connector Options additional Library directory, mine is: A:\Program\boost_1_61_0\libs
2.6 Test Code
The code runs successfully, indicating that the boost library is well-configured.