2016-12-14 98 views
0

我想編譯一個依賴於PCL和OpenCV的項目。從Cmake運行編譯文件時出現分段錯誤

的的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::waitKeycv::imshow代碼的某些部分發生錯誤,它似乎是與QT according to thisthis的問題。

回答

1

我有類似的問題。最後,我不得不建立PCL沒有QT(我也發現了幾個職位,說明干擾,但沒有找到解決辦法)

+0

我已經做了同樣的事情,它解決了問題。 – JTIM

+0

只是不是一個很好的解決方案:/ – JTIM

相關問題