to use the Boost library, infrastructure construction ... Make a note.
1.0 Linux:
System environment
[Email protected]:~#Cat/etc/lsb-releasedistrib_id=Ubuntudistrib_release=12.04Distrib_codename=precisedistrib_description="Ubuntu 12.04 LTS"[email protected]-b85m-ds3h:~#uname-Alinux melos1305-b85m-ds3h3.2.0- --generic #Panax Notoginseng-ubuntu SMP Wed APR - ,: +: AUtc -x86_64 x86_64 x86_64 Gnu/linux
1.1 Downloads Boost (1.56):
# wget -C http://jaist.dl.sourceforge.net/project/boost/boost/1.56.0/boost_1_56_0.tar.gz
Decompression boost_1_56_0.tar.gz
tar -xzvf boost_1_56_0. tar. gz
Enter the boost source code directory
1.1 compiling boost:
Not finished ~~~~~
2.0 windows:
Environment Win7 + vs2012 + boost 1.56.0
Download Boost http://www.boost.org/users/history/version_1_56_0.html#
D Disk new directory D:\boost, extracted to the D:\BOOST\BOOST_1_56_0, considering the future to have several versions of the Boost library, easy to manage
2.1 Compiling the installation:
Enter the Boost installation directory (D:\BOOST\BOOST_1_56_0) to perform
Bootstrap.bat
Generate Bjam
msvc11.0 corresponding Vs2012,--stagedir is the directory that is specified after compilation
Bjam stage--toolset=msvc-11.0 --stagedir="D: \boost\boost_1_56_0\bin\vc11" Link=static runtime-link=shared runtime-link=static threading=multi Debug Release
And then just wait ~
2.2 Configuring the Project environment:
Add a directory containing library, boost library source code files
Add a dynamic library directory
Boost::shared_ptr test code in the Boost smart pointer
1#include <iostream>2#include <vector>3#include <boost/smart_ptr/shared_ptr.hpp>4 5 #defineFUNC std::cout << __function__ << Std::endl;6 7 classA8 {9 Public:Ten A () {FUNC;} One~A () {FUNC;} A }; - - intMain () the { -Std::vector<boost::shared_ptr<a>>v; - -V.push_back (Boost::shared_ptr<a> (NewA)); +V.push_back (Boost::shared_ptr<a> (NewA)); -V.push_back (Boost::shared_ptr<a> (NewA)); + A return 0; at}
run~~~
3.0 References:
1 http://www.boost.org/doc/libs/1_56_0/more/getting_started/unix-variants.html
2 http://blog.csdn.net/zengraoli/article/details/8870446
3 http://blog.163.com/yungang_z/blog/static/175153133201262445539767/
Linux, Windows compiled install boost library (boost 1.56)