2016-12-26 97 views
0

我正在嘗試使用深度傳感器(PMD Camboard),並嘗試將捕獲的深度圖像顯示爲實時流。我可以從傳感器獲取數據。一旦我嘗試投入OpenCV部件,問題就會開始。單獨他們完美地工作,但一旦我嘗試整合它們,問題就會開始。我認爲錯誤與CMakeLists.txt有關,因爲即使我試圖編譯一個簡單的程序,只顯示攝像頭源,沒有任何depthsensor的東西,我也會得到同樣的錯誤。當我嘗試使用openCV的CMake進行編譯時,上述程序起作用。OpenCV Qt未定義的參考錯誤,同時編譯

編輯:我試過系統禁用的CMake的部分,看看哪些部分恰好觸發錯誤,發現行:

link_directories(${royale_LIB_DIR}) 

是導致錯誤的一個。

我收到以下錯誤,當我嘗試編譯:

/usr/local/lib/libopencv_highgui.so.3.1.0: undefined reference to `QWidget::isFullScreen() [email protected]_5' 
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QAbstractSlider::setMinimum(int)@Qt_5' 
/usr/local/lib/libopencv_highgui.so.3.1.0: undefined reference to `non-virtual thunk to QBoxLayout::minimumSize() [email protected]_5' 
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QTransform::type() [email protected]_5' 
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QWidget::hasHeightForWidth() [email protected]_5' 
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QPen::color() [email protected]_5' 
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QFrame::changeEvent(QEvent*)@Qt_5' 
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QOpenGLMultiGroupSharedResource::insert(QOpenGLContext*, QOpenGLSharedResource*)@Qt_5_PRIVATE_API' 
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QPaintDevice::~QPaintDevice()@Qt_5' 
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QObject::QObject(QObject*)@Qt_5' 
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QTabWidget::metaObject() [email protected]_5' 
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QColorDialog::QColorDialog(QWidget*)@Qt_5' 
/usr/local/lib/libopencv_highgui.so.3.1.0: undefined reference to `QFutureInterfaceBase::setThreadPool(QThreadPool*)@Qt_5' 
/usr/lib64/libQt5OpenGL.so.5: undefined reference to 

完整的錯誤在http://pastebin.com/KLKtzzSn

而我的CMakeLists.txt如下:

cmake_minimum_required(VERSION 2.8) 

set(CMAKE_PREFIX_PATH "share") 

#project (depthDataCallBack) 
project (webStream) 

find_package(OpenCV REQUIRED) 
find_package(royale REQUIRED) 


link_directories(${royale_LIB_DIR}) 

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) 

add_executable(webStream webStream.cpp) 

target_link_libraries(webStream ${OpenCV_LIBS}) 
target_link_libraries(webStream "${royale_LIBS}") 

我是新CMake,只有recently corrected。任何幫助,將不勝感激。

回答

0

錯誤列表顯示不存在鏈接中的Qt5 Widgets。將下面的行添加到您的CMakeLists.txt中:

target_link_libraries(webStream Qt5::Widgets) 
target_link_libraries(webStream Qt5::Core) 

另一個問題是Qt 5是否安裝在該系統中。 也讀到這裏:cmake doesn't link libGLU using QtOpenGL只要有Qt的OpenGL依賴缺失以及。