如何总是编译文件? [英] How to always compile a file?

查看:112
本文介绍了如何总是编译文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Qt项目与QML文件。每当我更改这些文件,我必须手动右键单击.qrc(资源)文件,并重新编译它。

I have a Qt project with QML files. Whenever I change these files, I have to manually right click the .qrc (resources) file and recompile it.

如何告诉visual studio总是编译某个文件,而不仅仅是当它认为它已经改变时?

How do I tell visual studio to always compile a certain file, not only when it thinks it has changed?

(以下是其他人要求的类似问题 eclipse flashdevelop

(Here are similar questions others have asked for eclipse and flashdevelop)

推荐答案

我在使用Qt Creator构建qt应用时遇到了同样的问题(尤其是使用QML文件作为资源。)我使用一点黑客解决了问题。

I encountered the same problem while building qt apps using Qt Creator.(Especially while using QML files as resources.) I solved the problem using a little hack.


  • 在源目录中创建了一个批处理文件,例如touch.bat。

  • 单行 copy qml.qrc / B + ,, / Y 其中 qml.qrc 是资源文件名。 / li>
  • 在QtCreator中打开我的项目,然后进入Project-> Build Steps-> Add Build Step-> Custom process step,并输入 touch.bat

  • 每当项目构建开始时,触摸 qml.qrc 。构建系统认为qml.qrc被修改并构建它。

  • Created a batch file say touch.bat in my source directory.
  • This batch file contains a single line copy qml.qrc /B+ ,,/Y where qml.qrc is the resource file name.
  • Opened my project in QtCreator and went to Project->Build Steps->Add Build Step->Custom process step and entered touch.bat
  • Whenever the project build starts, the qml.qrc is touched. The build system thinks that qml.qrc is modified and builds it.

你可以修改这个黑客为Visual Studio也(我没有试过)。尝试在Visual studio中添加 touch.bat 作为构建步骤。这个想法是愚弄构建系统认为你的.qrc被修改。

You can modify this hack for Visual Studio also.(I have not tried). Try adding touch.bat as a build step in Visual studio. The idea is to fool the build system to think that your .qrc is modified.

我猜这是一个已知的错误,仍然无法解决。请检查此错误报告
谢谢。

I guess this is a known bug which remains unresolved. Check this bug report. Thanks.

这篇关于如何总是编译文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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