Boost是一个功能强大、开源、跨平台、免费的c++程序库,被业界称为“准”c++标准库,能让你的c++开发更加简单,下面就开始安装Boost吧。
1、安装库
#yum install gcc gcc-c++ bzip2 bzip2-devel bzip2-libs python-devel -y
2、下载源码包
http://ncu.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
#tar -zvxf boost_1_59_0.tar.gz
cd /usr/local/src/boost_1_59_0
[[email protected] boost_1_59_0]# ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit ‘project-config.jam‘.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/build/doc/html/index.html
完后,再执行
./b2
然后就是大约25分钟的等待,如果最后出现:
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/usr/local/src/boost_1_59_0
The following directory should be added to linker library paths:
/usr/local/src/boost_1_59_0/stage/lib
再执行
./b2 install
即可完成安装。
编译安装完成后,会把boost头文件拷贝到/usr/local/include/目录下,库文件在/usr/local/lib/下。