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

PrecompiledHeaders.h include missing in moc after adding new class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 2.2.1
    • 2.2.0
    • General
    • None
    • win10

      VS 2013

      Qt 5.9.4
    • eb23401756cac8a4656adc0bbccbf0950470b417

    Description

      A QtMoc entry in the project file(*.vcxproj) after converting the project from "custom build" to Qt/MSBuild looks like this:

      <QtMoc Include="ToolboxView.h">
      <Define Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">...</Define>
      <ForceInclude Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">PrecompiledHeaders.h;../../ToolboxView.h</ForceInclude>
      <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName);...</IncludePath>
      <Define Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">...</Define>
      <ForceInclude Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">PrecompiledHeaders.h;../../ToolboxView.h</ForceInclude>
      <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName);...</IncludePath>
      </QtMoc>
      

       The <ForceInclude ... PrecompiledHeaders.h lines are not missing so the PrecompiledHeaders.h include will be added in the moc file.

       

      But both ForceInclude lines are missing when i add a new class (project tree --> right click --> add --> add Qt class) after the conversion to Qt/MSBuild.

      This results in the following error:

      error C1010: unexpected end of file while looking for precompiled header.Did you forget to add '#include "PrecompiledHeaders.h"' to your source?

       

      #include "PrecompiledHeaders.h is missing in the generated moc file.

      Manually adding the ForceInclude lines in the project file will fix the error.

      Reproduce bug:

      • convert project (with PrecompiledHeaders) to Qt/MSBuild
      • add new class: project tree --> right click --> add --> add Qt class
      • build

      Attachments

        For Gerrit Dashboard: QTVSADDINBUG-512
        # Subject Branch Project Status CR V

        Activity

          People

            mecfc Miguel Costa
            mikeee Mike Zeller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes