这里写自定义目录标题
Centos7.1下安装Boost
转载自
https://blog.51cto.com/59090939/1728699
新的改变
2015-12-27 02:04:03
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
[root@localhost 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/下。md文件,在上方工具栏可以选择导入功能进行对应扩展名的文件导入,
总结
执行操作
tar xvf boost_1_55_0.tar.gz
cd boost_1_55_0
./bootstrap.sh
sudo ./b2 install
编译完boost库之后,手动创建boost库安装路径
$ sudo mkdir /usr/local/boost
$ mkdir /usr/local/boost/include
$ mkdir /usr/local/boost/lib64
$ cp -rf boost /usr/local/boost/include
$ cp -rf stage/lib/* /usr/local/boost/lib64
在ld.so.conf中添加boost库的路径
$ vim /etc/ld.so.conf
/usr/local/boost/lib64/
执行ldconfig命令
$ ldconfig