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]QObject subclass compile error
Qt 6.11 is out! See what's new in the release blog

[SOLVED]QObject subclass compile error

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.7k Views 1 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.
  • F Offline
    F Offline
    fluca1978
    wrote on last edited by
    #1

    Hi all,
    I cannot see the problem within this class:

    @

    class TableViewHandler : public QObject
    {
    Q_OBJECT
    public:
    TableViewHandler( QObject* parent = 0 );
    ...
    }

    // implementation
    TableViewHandler::TableViewHandler( QObject* parent) : QObject(parent) {
    // do stuff
    }
    @

    which I cannot compile getting the error:

    @tableviewhandler.o: In function TableViewHandler': /sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:5: undefined reference to vtable for TableViewHandler'
    /sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:5: undefined reference to vtable for TableViewHandler' tableviewhandler.o: In function ~TableViewHandler':
    /sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:31: undefined reference to vtable for TableViewHandler' /sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:31: undefined reference to vtable for TableViewHandler'
    /sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:31: undefined reference to vtable for TableViewHandler' collect2: ld returned 1 exit status make: Leaving directory /sviluppo/c/WHR-build-desktop'
    make: *** [WHR] Error 1
    The process "/usr/bin/make" exited with code 2.
    Error while building project WHR (target: Desktop)
    When executing build step 'Make'@

    no matter what my constructor does. Any suggestion?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      Clean the project and re-run qmake.

      That should do the trick.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fluca1978
        wrote on last edited by
        #3

        I did a clean all and build again, but it did not solved the problem.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Asperamanca
          wrote on last edited by
          #4

          ...and ran qmake? I usually get those errors when the generated moc files no longer matches the class as it is now. I would also recommend manually deleting all generated files.

          A clean alone does not remove the generated files, nor does it cause qmake to run.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            See

            • http://developer.qt.nokia.com/forums/viewthread/6084
            • http://developer.qt.nokia.com/doc/qt-4.8/debug.html#common-bugs

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fluca1978
              wrote on last edited by
              #6

              Correct, the right sequence is clean all, run qmake, build all.

              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