boost 安装使用

  1. Linux安装boost
    • sudo apt install libboost-all-dev
  2. 卸载
    • sudo apt-get autoremove libboost*
  3. 静态看缺少 -fpic (如下报错时)

    usrbin/ld:/usr/Lib/x86_64-linux-gnu/Libboost_filesystem.a(operations.o): warning: relocation against _zst7nothroweeGLIBcxx_3.4’in read-only section `.text’
    usr/bin/td:/usr/Lib/x86_64-Linux-gnu/Libboost_filesystem.adirectory.o):relocation R_X86_64_pc32 against symbolZNSbostbsystemdetaillocat holderIvE24systencatego ry_instancee’ can not be used when making a shared object; recompile with -fpic

    • 查看 boost 版本:vi /usr/include/boost/version.hpp (或 /usr/local/include/boost/version.hpp)
    • 下载对应包:https://www.boost.org/
    • 编译
      ./bootstrap.sh
      ./b2 -j10 cflags=-fPIC cxxflags=-fPIC  #install --build-type=complete --layout=versioned threading=multi --prefix="/usr/lib/boost-1.74" --without-python --without-graph --without-graph_parallel --without-mpi --without-wave --without-test --without-log
      sudo ./b2 install
      
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值