C++——编译安装boost库

 

Trend 12:17:14
安装 boost到默认目录
./bootstrap.sh —-with-libraries=all —-with-python=python3 —-prefix=/usr/local
./b2 cxxflags="-std=c++11"
./b2 install —-prefix=/usr/local

 

 

 

编译安装boost的第二步。
./b2 cxxflags="-std=c++11"
指定使用c++11的标准,否则无法生成某些需要c++11的库,如不指定c++11,json库就无法编译,会跳过。

cxxflags 不会清楚上一次 cached 的 feature check 结果, 这是需要删除 cache 结果,
rm -rf bin.v2(其实只要移除里面的config.log和project-cache.jam文件即可)

参考: https://blog.csdn.net/cherisegege/article/details/80425545

 

 

gcc g++支持C++11 标准编译
取别名 :alias g++11="g++ -std=c++11"

g++ 4.8以上都支持c++11标准

 

-I  大写 i 表示include目录

-L 表示静太库目录

-l  表示静态库的名字

g++ -std=c++11 test.cpp  -o  test  -I/home/soft/boost/build/include -L/home/soft/boost/build/lib -lboost_thread -lpthread -lboost_json  -lboost_timer -lboost_random

 

 

Trend 18:35:59
Ubuntu16.04 cmake找不到boost库的解决办法
sudo apt-get install cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev

 

posted @ 2022-04-16 10:53  会飞的斧头  阅读(1287)  评论(0编辑  收藏  举报