2016-12-26 246 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依赖缺失以及。