我正在做一个可视化项目。它应该在 QGLViewer 上查看 3d 模型。我有一个像这样定义的 QGLViewer 子类:
class GLViewer : public QGLViewer
{
Q_OBJECT
public:
explicit GLViewer(QWidget *parent = 0,const QGLWidget* shareWidget=0, Qt::WFlags flags=0);
protected:
void initializeGL();
void resizeGL(int width, int height);
void paintGL();
signals:
public slots:
};
像这样实现c'tor:
GLViewer::GLViewer(QWidget *parent, const QGLWidget* shareWidget, Qt::WFlags flags):
QGLViewer(parent,shareWidget,flags)
{
}
我收到链接器错误:
glviewer.o: In function `GLViewer::GLViewer(QWidget*, QGLWidget const*, QFlags<Qt::WindowType>)':
glviewer.cpp:(.text+0x18): undefined reference to `vtable for GLViewer'
glviewer.cpp:(.text+0x20): undefined reference to `vtable for GLViewer'
编辑:
这是.pro
文件的内容:
QT += core gui opengl xml
TARGET = qglviewer-test
TEMPLATE = app
LIBS += -lqglviewer-qt4 -lGLU -lGLEW
SOURCES += main.cpp\
mainwindow.cpp \
glviewer.cpp
HEADERS += mainwindow.h \
glviewer.cpp
表格 += 主窗口.ui