我正在尝试编写一个名为QCV的Hernan Badino编写的计算机视觉库,但我有很多与QGLViewer库相关的链接问题。 编译器抛出的错误是:
//usr/lib/x86_64-linux-gnu/libQGLViewer.so.2: undefined reference to `gluNewQuadric'
//usr/lib/x86_64-linux-gnu/libQGLViewer.so.2: undefined reference to `gluUnProject'
//usr/lib/x86_64-linux-gnu/libQGLViewer.so.2: undefined reference to `gluCylinder'
//usr/lib/x86_64-linux-gnu/libQGLViewer.so.2: undefined reference to `gluPickMatrix'
//usr/lib/x86_64-linux-gnu/libQGLViewer.so.2: undefined reference to `gluSphere'
//usr/lib/x86_64-linux-gnu/libQGLViewer.so.2: undefined reference to `gluProject'
将与(我猜想)相关的问题链接到OpenGL / GLUT库。我正在使用CMake进行编译,并且在CMakeLists.txt文件中正确地请求(并找到)GLUT依赖项。 CMake文件的相关部分在这里:
##################################
# OpenGL
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
target_link_libraries(imgPlayer ${QT_LIBRARIES}
${OPENGL_LIBRARIES} ${GLUT_LIBRARY}
${QCV_LIB}
${CMAKE_THREAD_LIBS_INIT}
${OpenCV_LIBS})
和" cmake的输出。"是
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.6")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so
-- Found OpenCV: /usr/local (found version "3.2.0")
-- Configuring done
-- Generating done
编译器失败的可能原因是什么?
谢谢!
答案 0 :(得分:0)
GLU不是GLUT。缺少的参考文献来自GLU库。在CMake中
target_link_libraries(
…
${OPENGL_glu_LIBRARY}
…
);