gpt4 book ai didi

c++ - 找不到请求的 Boost 库 boost_lboost_thread

转载 作者:行者123 更新时间:2023-11-30 05:00:55 25 4
gpt4 key购买 nike

我一直在尝试在 CMake 环境中运行 Qt 项目。 Qt 项目使用 openCV 和 Boost 依赖项。在成功解决了所有的编译错误后,我一直在为一个Boost错误而苦恼。一旦我运行 CMake,我就会收到以下错误:

在/home/labrat/Desktop/cam-proc/build 中运行“/usr/bin/cmake/home/labrat/Desktop/cam-proc '-GCodeBlocks - Unix Makefiles'”。

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

Boost version: 1.58.0

Boost include path: /usr/include

Could not find the following Boost libraries:

boost_lboost_thread

Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
**Call Stack (most recent call first):
src/libCam/CMakeLists.txt:7 (find_package)**

Boost version: 1.58.0

Found the following Boost libraries:

system
thread
filesystem
chrono
date_time
atomic

-- Configuring incomplete, errors occurred!
See also "/home/labrat/Desktop/cam-proc/build/CMakeFiles/CMakeOutput.log".
See also "/home/labrat/Desktop/cam-proc/build/CMakeFiles/CMakeError.log".
*** cmake process exited with exit code 1.

我分析了给出的错误 CMake Error at/usr/share/cmake-3.5/Modules/FindBoost.cmake:1677 (message): 并打开了巨大的 FindBoost.cmake 文件,根据警告,这是错误所在的部分:

message(SEND_ERROR "无法找到请求的 Boost 库。\n${Boost_ERROR_REASON}")

  # Add pthread library on UNIX if thread component was found
_Boost_consider_adding_pthreads(Boost_LIBRARIES ${Boost_LIBRARIES})
else()
if(Boost_FIND_REQUIRED)
message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
else()
if(NOT Boost_FIND_QUIETLY)
# we opt not to automatically output Boost_ERROR_REASON here as
# it could be quite lengthy and somewhat imposing in its requests
# Since Boost is not always a required dependency we'll leave this
# up to the end-user.
if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
else()
message(STATUS "Could NOT find Boost")
endif()
endif()
endif()
endif()

此外,由于错误消息的另一部分说 Call Stack (most recent call first): src/libCam/CMakeLists.txt:7 (find_package) 在这里,我将 CMakeLists.txt 附加到libcam 项目(如果有帮助的话):

cmake_minimum_required (VERSION 2.8.12)
project(libCam)
find_package(Qt5Widgets REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Boost COMPONENTS filesystem lboost_thread system REQUIRED)
find_package(Boost COMPONENTS system thread filesystem REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
###
# make sure we use c++11
###
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})

include_regular_expression("^([^b]|b[^o]|bo[^o]|boo[^s]|boos[^t]|boost[^/]).*$")

qt5_wrap_ui (UIS_HDRS qtinclude/imagemanager.ui qtinclude/stereomanager.ui qtinclude/stereolistwidget.ui qtinclude/connectionmenu.ui)

file(GLOB LIBCAM_SRCS
"include/*.h"
"include/*.cpp"
"include/*.hpp"
"qtinclude/*.h"
"qtinclude/*.cpp"
"qtinclude/*.hpp"
)

file(GLOB UI_RC
"qtinclude/qdarkstyle/*.qrc"
)

add_library(libCam SHARED ${LIBCAM_SRCS} ${UIS_HDRS} ${UI_RC})
target_include_directories (libCam PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries (libCam Qt5::Widgets Qt5::PrintSupport Qt5::Core Qt5::Quick Qt5::Sql Qt5::XmlPatterns ${Boost_LIBRARIES} ${OpenCV_LIBS} )

过去两天我一直在谷歌搜索错误,寻找信息和代码来解决这个问题,但我的想法已经用完了。我尝试下载 boost 1.55,但没有成功,因为编译器只能看到 boost 1.58。

关于如何阐明此事的任何想法?有什么我遗漏的吗?

最佳答案

问题是线路

find_package(Boost COMPONENTS filesystem lboost_thread system REQUIRED)

应该改成

find_package(Boost COMPONENTS filesystem thread system REQUIRED)

或者简单地删除,因为它等同于以下行。

关于c++ - 找不到请求的 Boost 库 boost_lboost_thread,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50510556/

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