Qt Creator:当我启用 Shadow Builds 时,为什么会出现与丢失文件相关的错误? [英] Qt Creator: When I enable Shadow Builds, why do I get error related to missing files?

查看:70
本文介绍了Qt Creator:当我启用 Shadow Builds 时,为什么会出现与丢失文件相关的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在资源中添加了一张图片,显示效果很好.然后,我从 Qt 项目中的资源中删除了该文件,并将该文件移动到一个新的图像文件夹中,并将其重新添加到资源中.

I added an image to resources, and displaying it worked fine. Then, I removed the file from resources in the Qt project, and I moved the file to a new images folder and re-added it to resources.

现在,只有在构建设置中取消选中Shadow Build"选项时,项目才会编译.

Now the project will only compile if "Shadow Build" option is un-checked in build settings.

如果启用了 Shadow Build,我会收到一个错误,

If Shadow Build is enabled, I receive an error,

没有规则可以制作目标'../--project_name--/--image_name--',需要通过调试/qrc_qml.cpp".停止."

"No rule to make target '../--project_name--/--image_name--', needed by 'debug/qrc_qml.cpp'. Stop."

其中 --project_name-- 是我的项目名称等.

where --project_name-- is the name of my project, etc.

这个错误没有多大意义,考虑到该位置不再存在该文件.这是怎么回事?

This error doesn't make much sense, considering the file no longer exists at that location. What's going on here?

推荐答案

答案是运行 qmake.这可以通过 Build->run qmake 来完成.Qmake 会重新生成 makefile,而 'build' 和 'build all' 则不会.问题是在旧位置对文件的引用没有被重建删除.感谢 Andrii 在上面的评论中指出答案.

The answer is to run qmake. This can be done from Build->run qmake. Qmake regenerates makefiles, which 'build' and 'build all' do not. The problem is that references to the file at its old location were not being removed by rebuilding. Credit to Andrii for pointing to answer in comment above.

这篇关于Qt Creator:当我启用 Shadow Builds 时,为什么会出现与丢失文件相关的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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