<small id='CEgTr'></small><noframes id='CEgTr'>

    <bdo id='CEgTr'></bdo><ul id='CEgTr'></ul>

      <legend id='CEgTr'><style id='CEgTr'><dir id='CEgTr'><q id='CEgTr'></q></dir></style></legend><tfoot id='CEgTr'></tfoot>
    1. <i id='CEgTr'><tr id='CEgTr'><dt id='CEgTr'><q id='CEgTr'><span id='CEgTr'><b id='CEgTr'><form id='CEgTr'><ins id='CEgTr'></ins><ul id='CEgTr'></ul><sub id='CEgTr'></sub></form><legend id='CEgTr'></legend><bdo id='CEgTr'><pre id='CEgTr'><center id='CEgTr'></center></pre></bdo></b><th id='CEgTr'></th></span></q></dt></tr></i><div id='CEgTr'><tfoot id='CEgTr'></tfoot><dl id='CEgTr'><fieldset id='CEgTr'></fieldset></dl></div>
      1. 为什么在重建工作时构建后源代码的更改并不总是反映在机器代码中?

        时间:2023-08-25
        • <bdo id='EEq5G'></bdo><ul id='EEq5G'></ul>
        • <legend id='EEq5G'><style id='EEq5G'><dir id='EEq5G'><q id='EEq5G'></q></dir></style></legend>
          • <small id='EEq5G'></small><noframes id='EEq5G'>

                <tbody id='EEq5G'></tbody>

                  <tfoot id='EEq5G'></tfoot>
                  <i id='EEq5G'><tr id='EEq5G'><dt id='EEq5G'><q id='EEq5G'><span id='EEq5G'><b id='EEq5G'><form id='EEq5G'><ins id='EEq5G'></ins><ul id='EEq5G'></ul><sub id='EEq5G'></sub></form><legend id='EEq5G'></legend><bdo id='EEq5G'><pre id='EEq5G'><center id='EEq5G'></center></pre></bdo></b><th id='EEq5G'></th></span></q></dt></tr></i><div id='EEq5G'><tfoot id='EEq5G'></tfoot><dl id='EEq5G'><fieldset id='EEq5G'></fieldset></dl></div>
                  本文介绍了为什么在重建工作时构建后源代码的更改并不总是反映在机器代码中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有时,当我更改 Qt 项目(带有 mingw32 的 Qt Creator 2.1.0)中的代码时,这些更改不会在构建后反映在生成的机器代码中.这主要发生在我更改构造函数中的默认值或方法/构造函数中的参数顺序等内容时.通常,完全重建可以解决这个问题(但需要几分钟时间).

                  Sometimes when I change code in my Qt project (Qt Creator 2.1.0 with mingw32), the changes don't get reflected in the produced machine code after building it. This happens mostly when I change things like default values in constructors or the order of parameters in methods/constructors. Usually, a full rebuild fixes that (but takes a few minutes).

                  我通过在构建之前删除生成的可执行文件或库来帮助自己,这似乎在大多数情况下都有帮助.这是否意味着链接目标文件时出现问题?

                  I'm helping myself by deleting the generated executables or librarys before building, which seems to help most of the time. Does that mean that theres something going wrong when linking the object files?

                  我来自 java/.net,我习惯了不同的行为.如果有人能解释我做错了什么和/或指出一些相关文章,我会很高兴.

                  I'm coming from java/.net and I'm used to a different behaviour. I'd be happy if anyone could explain me what I'm doing wrong and/or point me to some related articles.

                  谢谢!

                  推荐答案

                  通常,在标题更改后,应重建包括该标题在内的所有源文件.但是,qmake 在这方面有点奇怪,您需要为当前目录以外的包含文件夹设置 DEPENDPATH.例如,如果你有

                  Usually, after a change in a header, all source files including that header should be rebuilt. However, qmake is a bit peculiar in this regard, you need to set DEPENDPATH for include folders other than the current directory. E.g., if you have

                  INCLUDEPATH += somepath_in_my_project
                  

                  也添加

                  DEPENDPATH += some_path_in_my_project
                  

                  仅使用 DEPENDPATH,如果 some_path_in_my_project 中的某些标头发生更改(如果它们包含该标头),则由 .pro 文件构建的文件会重新构建!

                  Only with DEPENDPATH, files built by the .pro files are rebuilt if some header in some_path_in_my_project changes (if they include that header)!

                  我建议为每个 INCLUDEPATH 行添加一个相同的 DEPENDPATH 行,除非您包含一些您不希望更改的系统目录.

                  I suggest to add for each INCLUDEPATH line an identical DEPENDPATH line, unless you include some system directory you don't expect to change.

                  使用 qmake 静态链接时存在类似的问题:如果静态库 foo.a 更改,则不会重新链接与之链接的二进制文件.这是 QMake 中的一个错误,没有生成正确的依赖项.

                  A similar problem exists when linking statically with qmake: If the static lib foo.a changes, binaries linking against it are not relinked. That's a bug in QMake, not generating the correct dependencies.

                  我在以前的项目中找到的解决方法:

                  A workaround I found in a former project:

                  static:unix:TARGETDEPS += path_to_my/somestaticlib.a
                  static:win32:TARGETDEPS += path_to_my/somestaticlib.lib
                  

                  编辑

                  从一段时间(Qt 5?)开始,上面的代码应该使用 POST_TARGETDEPS 而不是 TARGETDEPS.

                  Since some time (Qt 5?), above code should use POST_TARGETDEPS instead of TARGETDEPS.

                  这篇关于为什么在重建工作时构建后源代码的更改并不总是反映在机器代码中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 CMake、Clang 和 Ninja 在 Windows 上构建 C++ 项目 下一篇:制作配方以防止重建非依赖目标

                  相关文章

                  <tfoot id='Pjiri'></tfoot>
                • <legend id='Pjiri'><style id='Pjiri'><dir id='Pjiri'><q id='Pjiri'></q></dir></style></legend>
                    <bdo id='Pjiri'></bdo><ul id='Pjiri'></ul>

                    <i id='Pjiri'><tr id='Pjiri'><dt id='Pjiri'><q id='Pjiri'><span id='Pjiri'><b id='Pjiri'><form id='Pjiri'><ins id='Pjiri'></ins><ul id='Pjiri'></ul><sub id='Pjiri'></sub></form><legend id='Pjiri'></legend><bdo id='Pjiri'><pre id='Pjiri'><center id='Pjiri'></center></pre></bdo></b><th id='Pjiri'></th></span></q></dt></tr></i><div id='Pjiri'><tfoot id='Pjiri'></tfoot><dl id='Pjiri'><fieldset id='Pjiri'></fieldset></dl></div>

                    1. <small id='Pjiri'></small><noframes id='Pjiri'>