【问题标题】:Installing boost on macos在 macos 上安装 boost
【发布时间】:2020-11-23 09:39:07
【问题描述】:

我正在尝试使用 boost 库创建一个简单的示例。我可以成功地使用 CMake 进行初始设置,并且它找到了提升。

在 CMakeLists.txt 中使用以下代码:

cmake_minimum_required(VERSION 3.18)
project(edge_detector)

find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

add_executable(edge_detector main.cpp)
target_include_directories(edge_detector PUBLIC ${Boost_INCLUDE_DIRS}) 
target_link_libraries(edge_detector ${Boost_LIBRARIES})

但是,当我尝试使用 make 或 CMake --build 构建项目时。未找到 boost,我遇到了这个错误:

我不确定我错过了什么,我将不胜感激任何帮助

【问题讨论】:

标签: c++ macos boost cmake


【解决方案1】:

您的 include 指令必须包含文件而不是目录。 替换

#include <boost/algorithm/string>

#include <boost/algorithm/string.hpp>

【讨论】:

  • 非常感谢,在这上面卡了一天哈哈
猜你喜欢
  • 2019-02-21
  • 2016-05-03
  • 2020-07-02
  • 2019-03-31
  • 2021-02-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多