Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] OpenGlWidget Error: undefined reference to `vtable for GLWidget'
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] OpenGlWidget Error: undefined reference to `vtable for GLWidget'

Scheduled Pinned Locked Moved General and Desktop
openglqt5.4
3 Posts 2 Posters 3.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lays147
    wrote on 21 Jul 2015, 01:23 last edited by Lays147
    #1

    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_OBJECT

    public:
    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?

    Lays Rodrigues
    Newby on Qt - Learning always!
    Using QT 5.7
    ArchLinux

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Jul 2015, 12:03 last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      L 1 Reply Last reply 21 Jul 2015, 16:15
      0
      • S SGaist
        21 Jul 2015, 12:03

        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

        L Offline
        L Offline
        Lays147
        wrote on 21 Jul 2015, 16:15 last edited by Lays147
        #3

        @SGaist Thanks! Solved this!

        Lays Rodrigues
        Newby on Qt - Learning always!
        Using QT 5.7
        ArchLinux

        1 Reply Last reply
        0

        1/3

        21 Jul 2015, 01:23

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved