Details
Description
Steps to reproduce / test case
1) Create a new Qt Application project. Use standard settings.
2) Exclude the following files from build (these files were automatically created):
.h (right click on file, properties, yes to exclude from build)
3) Fix main.cpp so it no longer uses code from
.h
4) Compiling the projects will now result in an error.
When excluding a file from the build, visual studio will still try to compile the moc file that would have been generated if it was included in the build.
Compiler output:
----------------
1>------ Build started: Project: Bug, Configuration: Debug Win32 ------
1>Compiling...
1>moc_bug.cpp
1>c1xx : fatal error C1083: Cannot open source file: '.\GeneratedFiles\Debug\moc_bug.cpp': No such file or directory
1>qrc_bug.cpp
1>Generating Code...
1>Build log was saved at "...\Documents\Visual Studio 2008\Projects\Bug\Bug\Debug\BuildLog.htm"
1>Bug - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Observations:
-------------
When removing the Q_OBJECT declaration from bug.h it compiles without errors. However this can not be used as a workaround since the file might be used (not excluded from the build) in a different build configuration.