[SOLVED] OpenGlWidget Error: undefined reference to `vtable for GLWidget'
-
Hello guys!
I'm trying to simulate some points in the plane of the environment (x, y, z). Then i created a class Glwidget.h as follows:#ifndef GLWIDGET
#define GLWIDGET
#endif // GLWIDGET#include <QOpenGLWidget>
#include <QObject>class GLWidget : public QOpenGLWidget
{
Q_OBJECTpublic:
GLWidget(QWidget *parent);
void paintGL();
void initializeGL();
void resizeGL(int w, int h);
};
//Constructor
GLWidget::GLWidget(QWidget *parent): QOpenGLWidget(parent)
{}
void GLWidget::paintGL()
{
/* glBegin(GL_POINT);
glVertex3d(x,y,z);
glEnd();*/
}void GLWidget::initializeGL()
{
glClearColor(1,1,0,0);
}void GLWidget::resizeGL(int w, int h)
{}
Then I inserted a QOpenGLWidget in my .ui file and promoted to glwidget.h
But at compile time, the following error occurs: undefined reference to `vtable is GLWidget '
I could not find much solution in google, can anyone help me? -
Hi,
this error generally comes from adding/removing the Q_OBJECT macro. Re-run qmake and rebuild your project and you should be good to go
-
@SGaist Thanks! Solved this!