我正在尝试熟悉 QGLViewer ( http://libqglviewer.com/ ),所以我安装了它 (在 Ubuntu 14.04 上),我正在尝试运行 simpleViewer (这是一个提供的示例)。现在,可以使用 qmake 构建代码,但我想用 cmake 编译代码,所以我编写了以下 CMakeLists.txt:
cmake_minimum_required(VERSION 2.6)
PROJECT(simple_viewer)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE})
FIND_PACKAGE(QGLViewer REQUIRED)
INCLUDE_DIRECTORIES(${QGLVIEWER_INCLUDE_DIR})
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${QT_INCLUDES})
ADD_EXECUTABLE(${PROJECT_NAME} main.cpp simpleViewer.cpp)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${QGLVIEWER_LIBRARY})
我能够构建项目,但是当我启动可执行文件时,这是我得到的错误:
dede@dede-P35V2:~/src/simple_viewer/build$ ./simple_viewer
*** Error in `./simple_viewer': realloc(): invalid pointer: 0x00007f64d34df840 *** Aborted
如果有人可以解释我出了什么问题,我会很高兴!
谢谢!