博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
boost1.7 centos7编译
阅读量:758 次
发布时间:2019-03-22

本文共 676 字,大约阅读时间需要 2 分钟。

下载后解压

tar zxvf xxxx.tar.gz

运行编译

./bootstrap.sh

./b2 -j 5
./b2 install
ldconfig

在usr/local/include/boost 下可以看到新安装的文件,写以下测试代码

#include 
#include
using namespace boost::filesystem; int main(int argc, char *argv[]){
std::cout << "Boost version is" << BOOST_VERSION / 100000 << "." // maj. version << BOOST_VERSION / 100 % 1000 << "." // min. version << BOOST_VERSION % 100 // patch version << std::endl; std::cout << "the exe file size :" << file_size("./test") << std::endl; return 0;}

编译

g++ test.cpp -o test -lboost_system -lboost_filesystem

运行

./test

程序运行
显示使用boost版本为1.70.0
生成的可执行文件大小为27824 字节。注意一定要看版本。1.7版本的boost在windows下和linux运行无误,可以使用其asio的协程。

转载地址:http://gkowk.baihongyu.com/

你可能感兴趣的文章