- 下载源码和编译
wget https://netix.dl.sourceforge.net/project/boost/boost/1.63.0/boost_1_63_0.tar.gz
tar zxf boost_1_63_0.tar.gz
cd boost_1_63_0
./bootstrap.sh --prefix="your install path "
./bjam --layout=versioned --buid_type=complete --toolset=gcc install
- 添加环境变量
- 修改/etc/profile, 文件末尾添加
export BOOST_INCLUDE = "your install path "/include export BOOST_LIB ="your install path "/lib
- 在/etc/profile.d/ 中新建一个shell文件boost.sh
#!/bin/sh export BOOST_INCLUDE = "your install path "/include export BOOST_LIB ="your install path "/lib
命令执行: source /etc/profile.d/boost.sh ,以后在编译程序的时候,只需要加上 :-I$BOOST_INCLUDE - L$BOOST_LIB
- 编译的时候遇到的问题,就是却bzlib和python库,于是要先安装
yum install bzip2-devel yum install python-devel
(转自我另一个博客 boost库编译 )