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. Undefined reference to resizeEvent(QResizeEvent*)

Undefined reference to resizeEvent(QResizeEvent*)

Scheduled Pinned Locked Moved Solved General and Desktop
qopenglwindow
4 Posts 3 Posters 631 Views
  • 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.
  • Tom assoT Offline
    Tom assoT Offline
    Tom asso
    wrote on last edited by
    #1

    My application includes a class “Parabola” which is a subclass of QOpenGLWindow, which is a subclass of QObject. The Parabola class includes the Q_OBJECT macro:

    #ifndef PARABOLAWINDOW_H
    #define PARABOLAWINDOW_H
    
    #include <QOpenGLWindow>
    #include <QOpenGLFunctions>
    #include <QOpenGLBuffer>
    #include <QOpenGLVertexArrayObject>
    #include <QMatrix4x4>
    
    class QOpenGLShaderProgram;
    
    class ParabolaWindow : public QOpenGLWindow,
                   protected QOpenGLFunctions
    {
      Q_OBJECT
    

    The project compiles, but the linker gives this result:

    g++ -Wl,-O1 -Wl,-rpath,/home/oreilly/Qt/5.14.2/gcc_64/lib -o parabola main.o ParabolaWindow.o qrc_qml.o moc_ParabolaWindow.o   /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Quick.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Gui.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5QmlModels.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Qml.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Network.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Core.so -lGL -lpthread   
    
    moc_ParabolaWindow.o:(.data.rel.ro._ZTV14ParabolaWindow[_ZTV14ParabolaWindow]+0xa0): undefined reference to `ParabolaWindow::resizeEvent(QResizeEvent*)'
    collect2: error: ld returned 1 exit status
    Makefile:282: recipe for target 'parabola' failed
    make: *** [parabola] Error 1
    

    Parent class QOpenGLWindow defines method resizeEvent(QResizeEvent*), which is defined in libQt5Gui.so, and I am linking with that library. I have other projects that subclass QOpenGLWindow, yet they do not have this error when I link. What is causing this error?

    Thanks!

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Tom-asso said in Undefined reference to resizeEvent(QResizeEvent*):

      resizeEvent

      You defined resizeEvent() in your class but did not implement it.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Beside @Christian-Ehrlicher good point, you seem to have made it a slot which is wrong. This method will automatically be called but it is not a slot.

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

        1 Reply Last reply
        0
        • Tom assoT Offline
          Tom assoT Offline
          Tom asso
          wrote on last edited by
          #4

          @Christian-Ehrlicher and @SGaist - thanks very much for help, and you are both right of course. Super-useful to have your additional eyes on my code!

          1 Reply Last reply
          0

          • Login

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