我正在尝试编译依赖于PCL和OpenCV的项目。
CMakeLists.txt看起来像:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(pcl_visualizer_viewports)
find_package(PCL 1.2 REQUIRED)
find_package(OpenCV REQUIRED)
message("this is my message " ${OpenCV_LIBRARIES} )
message("this is my message " ${OpenCV_INCLUDE_DIRS} )
message("this is my message " ${OpenCV_INSTALL_PATH} )
include_directories(${PCL_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (pcl_visualizer_demo pcl_visualizer_demo.cpp readInputFile.cpp readInputFile.h defines.h helper.cpp helper.h Image_Safety.h Image_Safety.cpp)
target_link_libraries (pcl_visualizer_demo ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
然而,结果是分段错误和核心转储。我已阅读Cmake tutorial,但我没有发现问题。 CMake为所有人生成目标文件:
Scanning dependencies of target pcl_visualizer_demo
[ 20%] Building CXX object CMakeFiles/pcl_visualizer_demo.dir/Image_Safety.cpp.o
[ 40%] Building CXX object CMakeFiles/pcl_visualizer_demo.dir/helper.cpp.o
[ 60%] Building CXX object CMakeFiles/pcl_visualizer_demo.dir/image_converter.cpp.o
[ 80%] Building CXX object CMakeFiles/pcl_visualizer_demo.dir/readInputFile.cpp.o
[100%] Building CXX object CMakeFiles/pcl_visualizer_demo.dir/pcl_visualizer_demo.cpp.o
Linking CXX executable pcl_visualizer_demo
查看链接详细信息,提到了不同的目标文件,我将其解释为链接。
我错过了什么?
更新
很奇怪所以使用基本的opencv函数cv::waitKey
和cv::imshow
在代码的某些部分发生错误,这似乎是QT according to this和this的问题
答案 0 :(得分:1)
我有类似的问题。最后我不得不在没有QT的情况下建立PCL(我还发现了几个帖子说明了干扰,但没有找到解决方案)