moc-ed files being excluded from build in Visual Studio 2010

后端 未结 1 1833
陌清茗
陌清茗 2021-01-27 02:37

I have a VS2010 solution with couple of Qt-based projects. Every time when i modify files from one certain project, generated files (moc_*.cpp ones) changes its properties to be

相关标签:
1条回答
  • 2021-01-27 02:56

    There is a related question.

    First you have to check the MocDirectory in the Qt Project Settings. Originally, I set it to the wrong value $(Configuration) and encountered the same problem as you.

    After I changed it to $(ConfigurationName), the problem disappeared.

    The reason that when the wrong value is set, MocDirectory points to the same directory for different project configuration (e.g. debug and release). When the project is built, it will excluded the generated files in MocDirectory with respect to other project configurations. Since all the configurations refer to the same MocDirectory, all generated files will be excluded.

    0 讨论(0)
提交回复
热议问题