簡體   English   中英

在 macos 上安裝 boost

[英]Installing boost on macos

我正在嘗試使用 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,我遇到了這個錯誤:

在此處輸入圖像描述

我不確定我錯過了什么,我將不勝感激

您的 include 指令必須包含文件而不是目錄。 代替

#include <boost/algorithm/string>

#include <boost/algorithm/string.hpp>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM