从 Visual Studio 2010 中的构建中排除 moc-ed 文件 [英] moc-ed files being excluded from build in Visual Studio 2010

查看:33
本文介绍了从 Visual Studio 2010 中的构建中排除 moc-ed 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 VS2010 解决方案,其中包含几个基于 Qt 的项目.每次当我修改某个项目中的文件时,生成的文件(moc_*.cpp 文件)都会更改其属性以从构建中排除.检查了所有可用的属性,但找不到与该问题相关的任何内容(尽管没有尝试从头开始重新创建项目).

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?

推荐答案

有一个相关的问题.

首先您必须检查 Qt 项目设置中的 MocDirectory.本来我把它设置为错误的值 $(Configuration) 和你遇到了同样的问题.

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.

我把它改成$(ConfigurationName)后,问题就消失了.

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

设置错误值时,不同项目配置(例如调试和发布)的MocDirectory指向同一目录的原因.项目构建时,会相对于其他项目配置排除 MocDirectory 中生成的文件.由于所有配置都指向同一个 MocDirectory,因此所有生成的文件都将被排除.

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.

这篇关于从 Visual Studio 2010 中的构建中排除 moc-ed 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆