下载boost源码
boost下载地址
解压到一个目录
tar -zxvf boost_1_66_0.tar.gz
执行bootstrap.sh脚本:
进入boost_1_66_0目录中
cd boost_1_66_0
./bootstrap.sh --with-libraries=all --with-toolset=gcc
--with-liraries:需要编译的库
--with-toolset:编译时使用的编译器
编译安装boost库
./b2 install --prefix=/usr
--prefix:boost库的安装目录;若不加此参数,则默认安装在/usr/local目录下
最终结果如下,生成的lib文件(/usr/local/lib):
![](https://img-blog.csdnimg.cn/2020033116594332.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTE4MzI1MjU=,size_16,color_FFFFFF,t_70)
生成的头文件(/usr/local/include):
![](https://img-blog.csdnimg.cn/20200331170141335.png)
原文地址:https://www.cnblogs.com/smallredness/p/9245127.html