QT += opengl
這是因為直接調用了OpenGL的函數,需要在pro中增加以下庫引用:
win32-g++ {
LIBS += -lopengl32 -lglu32 -glmf32
}
win32-msvc*{
LIBS += opengl32.lib glu32.lib glmf32.lib
}
qt建議使用:
QOpenGLFunctions.
出現error: undefined reference to `gluLookAt@72' 這個是缺 -lglu32