Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
2.3.2
-
None
-
Windows 10 Pro and Visual Studio 2019
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)\.