gpt4 book ai didi

c++ - CMake 在我的主机中找不到用于交叉编译器的 boost 库,但在 Raspberry Pi 中找到了

转载 作者:行者123 更新时间:2023-11-28 07:19:51 31 4
gpt4 key购买 nike

我在 Raspberry Pi 中下载了 libboost1.50-all,并成功编译并执行了一个使用线程的程序。在 CMake 中也发现了库。然后,我将 boost 的库及其包含的库分别从/usr/lib 和/usr/include/boost 复制到 C:\Boost,这样层次结构就变成了:

C:
-> Boost
-> lib
... files
-> include
-> boost
... files

然后我使用相同的 CMakeLists.txt 和源代码,但找不到库。

注意:我使用的交叉编译器完全正常工作,我能够使用 std 库在 Cygwin 中使用 CMake 生成可执行文件。我什至指定了库的位置、用户和根目录。

有什么我遗漏的吗?

cmake_minimum_required(VERSION 2.8)

set(BOOST_ROOT C:/Boost/)
set(BOOST_INCLUDEDIR C:/Boost/include/)
set(BOOST_LIBRARYDIR C:/Boost/lib/)

SET(Boost_DEBUG ON)
find_package(Boost 1.50.0 COMPONENTS thread system)

if (Boost_FOUND)
include_directories (${Boost_INCLUDE_DIRS})
add_executable (thread thread.cpp)
target_link_libraries(thread ${Boost_LIBRARIES})
endif()

enter image description here

最佳答案

使用 CMAKE-GUI,然后检查是否检测到您的 boost 库。如果没有则在 CMAKE-GUI 中手动设置并重新配置。

关于c++ - CMake 在我的主机中找不到用于交叉编译器的 boost 库,但在 Raspberry Pi 中找到了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19665884/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com