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

Qt VS tools (VS 2019) generates incorrect moc custom build for $(SolutionDir) macro

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 2.3.2
    • General
    • None
    • Windows 10 Pro and Visual Studio 2019
    • Windows

    Description

      In the case that in project settings we have an include additional directory expressed by the macro $(SolutionDir) the generation of the custom build step for QOBJECT .h file is incorrect.

      The command is generated as:

      "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DTOOLS_LIB -DUNICODE -DWIN32 -DWIN64 -DNOMINMAX -DQT_CORE_LIB -DQT_GUI_LIB -D_USE_MATH_DEFINES -DQT_XML_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(SolutionDir)" "-fstdafx.h" "-f../../%(Filename)%(Extension)"

       

      But in Visual Studio &(SolutionDir) evaluates with a final \ character and this is not accepted by the moc command which fails with the next parameter "-fstdafx.h". This causes that the line

      #include "stdafx.h"

      is not generated and the compiler will generated an error in case the project uses precompiled headers.

       

      The same version of Qt VS Tools for Visual Studio 2017 generates correctly the moc command adding a \. to the "-I$(SolutionDir)" parameter: "-I$(SolutionDir)\."

       

      Actually a work around is to change in the project includes $(SolutionDir) with $(SolutionDir)\.

      Attachments

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

        Activity

          People

            mecfc Miguel Costa
            marco.beninca71 Marco Beninca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes