Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-36107

MOC fails on Q_INTERFACES macro

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 5.2.0
    • Build tools: moc
    • None
    • Visual Studio 2012, Qt 5.2, Qt addin 1.2

    Description

      MOC fails on Q_INTERFACES macro, if header file with interface is included by absolute path.

      Project structure:

      + app
        main.cpp
        FooImpl.cpp
        FooImpl.h
      + InterfaceLib
        IFoo.h
      

      Interface is declared in IFoo.h, and included in FooImpl.h. In project configuration $(SolutionDir) is added as Include Path.
      FooImpl.h:

      ...
      #inlcude "InterfaceLib/IFoo.h"
      class FooImpl : public QObject
      {
        Q_OBJECT
        Q_INTERFACES( IFoo )
      };
      

      Moc'ing fails with "error : Undefined interface".
      Bug is not reproducing with relative path:

      #inlcude "../InterfaceLib/IFoo.h"
      

      Seems, that similar issues:
      https://bugreports.qt-project.org/browse/QTBUG-12585
      http://qt-project.org/forums/viewthread/24301

      Added:
      Sample project (Visual Studio 2012, Qt 5.2, Qt addin 1.2) - https://dl.dropboxusercontent.com/u/35260560/bugs/QtMocBug.zip

      Attachments

        Activity

          People

            ogoffart Olivier Goffart (Woboq GmbH)
            sazonov Dmitry Sazonov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: