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

南笙酒味 提交于 2019-12-02 10:20:21

问题


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 excluded from build. Checked all the available properties but couldn't find anything related to the issue (didn't tried to recreate the project from scratch though).

Any chances to fix that?


回答1:


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.



来源:https://stackoverflow.com/questions/11941885/moc-ed-files-being-excluded-from-build-in-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!