C++:Boost库安装

1、目录结构说明

在boost官网下载boost压缩文件(我用的是boost_1_74_0.zip这个版本),解压后主要目录结构说明如下:

2、安装

安装Boost所需的依赖库,主要的是icu以获取boost :: regex支持:

sudo apt-get update
sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev 

Boost的引导程序设置(自定义安装路径,比如“/usr/local”):

wyr@iZm5e9phbzdxx0lysrv9t2Z:~/packages/boost_1_78_0$ ls
boost            boostcpp.jam  boost.png      bootstrap.sh  index.htm   INSTALL  libs             more       rst.css  tools
boost-build.jam  boost.css     bootstrap.bat  doc           index.html  Jamroot  LICENSE_1_0.txt  README.md  status
wyr@iZm5e9phbzdxx0lysrv9t2Z:~/packages/boost_1_78_0$ 

 运行以下命令:

./bootstrap.sh --prefix=/home/wyr/develop/3thparty
wyr@iZm5e9phbzdxx0lysrv9t2Z:~/packages/boost_1_78_0$ ./bootstrap.sh --prefix=/home/wyr/develop/3thparty
Building B2 engine..

###
###
### Using 'gcc' toolset.
###
###

g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


###
###

> g++ -x c++ -std=c++11 -O2 -s -DNDEBUG builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filesys.cpp filent.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp modules/order.cpp modules/path.cpp modules/property-set.cpp modules/regex.cpp modules/sequence.cpp modules/set.cpp -o b2
> cp b2 bjam
tools/build/src/engine/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... /usr
Backing up existing B2 configuration in project-config.jam.1
Generating B2 configuration in project-config.jam for gcc...

Bootstrapping is done. To build, run:

    ./b2
    
To generate header files, run:

    ./b2 headers

The configuration generated uses gcc to build by default. If that is
unintended either use the --with-toolset option or adjust configuration, by
editing 'project-config.jam'.

Further information:

   - Command line help:
     ./b2 --help
     
   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html
     
   - B2 documentation:
     http://www.boost.org/build/

wyr@iZm5e9phbzdxx0lysrv9t2Z:~/packages/boost_1_78_0$ 

如果我们需要MPI,则需要在user-config.jam文件中设置标志(user-config.jam文件可以在Boost根目录中创建):

user_configFile=`find $PWD -name user-config.jam`
echo "using mpi ;" >> $user_configFile

安装Boost:

# 查找最大物理核数:
n=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
# 安装
./b2 --with=all -j $n install 

C++ | boost库入门_烫青菜的博客-CSDN博客_boost库

在Ubuntu上安装Boost的五种方法(全网最全,建议收藏)_小熊coder的博客-CSDN博客_ubuntu boost

Boost基础篇——安装_黄某某的程序猿之路的博客-CSDN博客_boost安装

boost - 安装boost库时无法找到user_config.jam - Thinbug

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值