Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-5019

Build system does not detect when a class is changed from 'not inheriting from QObject' to 'inheriting from QObject' :: "undefined vtable for <SIGNAL NAME>"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 2.2.0
    • None
    • verified in Windows 7 x64, Ubuntu x86_64

    Description

      When a class is changed from 'not inheriting from QObject' to 'inheriting from QObject', signal methods are not generated, leading to undefined vtable for XXX errors. The workaround is to update the .pro file's modification time manually ('touch <.pro file>' on linux, or add a space and save on windows, etc.).

      To verify bug,
      1) create new Qt project (Qt Gui is handy/quick)
      2) add a new class to the project with no base classes
      3) build project
      4) edit class '.h' & '.cpp' to inherit from QObject (Q_OBJECT macro, proper constructor, some arbitrary signals/slots, and at least one 'emit SIGNAL_XXX')
      5) without modifying anything else, rebuild the project
      6) verify linking fails with "undefined reference to vtable for 'SIGNAL_XXX'..."
      7) modify project .pro file ( add a space, delete the space, and then save )
      8) without modifying anything else, rebuild project
      9) verify that the project builds correctly now.

      Proposed solutions
      1) quick n dirty solution: the "clean project" or "rebuild project" action should update the .pro file's modification time
      caveat, user still has to clean/rebuild project to link properly
      2) optimal solution : add simple regular expression test of each file to detect relevant inheritance changes, and regenerate makefile as appropriate

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              dt Daniel Teske
              theartofmurder Christopher N Wolfe
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes