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

Q_OBJECT in cpp triggers MSB8017 warning

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 4.8.0
    • 4.7.0
    • Build tools: qmake
    • None
    • Win7 32-bit
      VS2010
      Qt 4.7.0 VS2008 reconfigured for 2010
      AddIn 1.1.6
    • dcd2f8295179170d6459edcb06ff9bd339748de6

      If class with Q_OBJECT is in header file than Generated File is named moc_xxx.cpp and there are no issues.

      If class with Q_OBJECT is in cpp file than Generated File is xxx.moc and warning MSB8017 is output:

      A circular dependency has been detected while executing custom build commands for item "GeneratedFiles\Debug\main.moc". This may cause incremental build to work incorrectly.

      Code example – just put this into main.cpp, save and build with Visual Studio:

      #include <QtCore/QCoreApplication>
      
      class AddInHatesThis : public QObject
      {
      	Q_OBJECT
      
      public:
      	AddInHatesThis() {}
      	virtual ~AddInHatesThis() {}
      };
      
      int main(int argc, char *argv[])
      {
      	QCoreApplication a(argc, argv);
      
      	return a.exec();
      }
      

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

            jbornema Joerg Bornemann
            harvey___ Galadrius Krunthar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes