1 Unzip Boost_1_57_0.zip 2 ./bootstrap.sh3 ./b2 toolset=gcc cxxflags="-std=c++11" Install4 Find/-name libboost*.a
Under the/usr/local/lib directory
Header files in
Under the/usr/local/include/boost directory
Parameter--prefix=/usr can be added after install
Test:
Test.cpp
1#include <boost/lexical_cast.hpp>2#include <iostream>3 intMain ()4 {5 usingBoost::lexical_cast;6 intA = lexical_cast<int> ("123");7 Doubleb = lexical_cast<Double> ("123.12");8std::cout<<a<<Std::endl;9std::cout<<b<<Std::endl;Ten return 0; One}
Test2.cpp
#include <iostream> #include <cassert> #include <string> #include <boost/regex.hpp>using Namespace Std;using namespace Boost;int main () { const char *szreg = "(\\w+)://((\\w+\\.) *\\w+) ((/\\w*) *) (/\\w+\\.\\w+)? "; const char *SZSTR = "http://www.cppprog.com/2009/0112/48.html"; Boost::regex Reg (Szreg); BOOL R=boost::regex_match (SZSTR, Reg); ASSERT (R); Whether to match return 0;}
Compile:
g++ Boost.cpp-o boost/usr/local/lib/libboost_regex.a-i/usr/local/include
Linux compiled installation boost-1_57