链接器错误与CMake和点云库

时间:2017-11-30 21:17:42

标签: c++ cmake linker-errors point-cloud-library

我已经尝试安装并将PointCloud Library添加到我的Project中,但我总是遇到链接器错误。这是我的Cmake文件:

cmake_minimum_required(VERSION 2.8)

project(OpenCV-BATest)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(SOURCES regression.h)

find_package(Qt5Core)
find_package( OpenCV REQUIRED )
find_package(PCL 1.3 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})

add_executable(${PROJECT_NAME} "main.cpp")

target_link_libraries(${PROJECT_NAME} Qt5::Core ${OpenCV_LIBS} ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES})

有趣的是OpenCV lib,我用同样的方式,没有创建任何"未定义的引用..."错误,但只有PCL库。 enter image description here

1 个答案:

答案 0 :(得分:1)

找到答案,这应该包括在内

target_link_libraries(${PROJECT_NAME} Qt5::Core ${OpenCV_LIBS} ${PCL_LIBRARIES})

代替。