Centos7.1下安装Boost

这里写自定义目录标题

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值