Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-706

Moc'ing of cpp files does not work properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • None
    • 2.4.2
    • Build-time integration
    • None
    • Visual Studio 2017
    • Windows

    Description

      When defining a QObject class / using the Q_OBJECT macro in a cpp file, the VS plugin properly registers the file as QtMoc item.

      This causes the file to be moc'ed during build, but also takes the original cpp file out of normal compilation.

      In this case, the generated cpp file fails to compile, because it is missing the class definitions from within the original cpp file.

      The usual workaround for this is to include the generated cpp file at the end of the original source file, but this does not work anymore: By default, the original cpp file isn't compiled at all anymore.

      The "Dynamic C++ Source" property seems to be the way to change this behavior, but switching it from the default "Output File" to "Input File" just disables compilation of the generated file (expected behavior for "Disable"). The original source file is still NOT compiled at all.

       

      (See attached example project, "MocCPP.cpp" is not compiled at all)

       

      Attachments

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

        Activity

          People

            ali.demiralp Ali Can Demiralp
            fgross Florian Groß
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes