cmake时提示Could not find the following Boost libraries: boost_system boost_iostreams

本文介绍了一种常见问题的解决方案:在使用CMake构建项目时,如何解决找不到已安装的Boost库的问题。通过创建软链接,成功使CMake识别到Boost_system和Boost_iostreams库。

一个项目的用到了boost库,然而在编译时报错:

CMake Error at /usr/share/cmake-3.5/Modules/FindBoost.cmake:1677 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/include

  Could not find the following Boost libraries:

          boost_system
          boost_iostreams

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.

我明明装了boost库啊,怎么找不到呢,于是用 locate boost_system命令查看,得到:

/usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0

说吗这个库确实有,只是cmakelists没找到。为啥它找不到呢?因为它找的是libboost_system.so文件,给它加个1.58.0它就找不到了。不过好办,我们建立个软链接:

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值