为什么我的单元“用不同的版本编译”的我自己的文件? [英] Why are my units "compiled with a different version" of my own files?

查看:187
本文介绍了为什么我的单元“用不同的版本编译”的我自己的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个使用插件的程序。不幸的是,插件框架的动态链接将RTL和VCL从我的项目EXE和进入BPL版本,并且他们没有启用调试信息。

I'm building a program that uses plugins. Unfortunately, the plugin framework's dynamic linking forces the RTL and VCL out of my project EXE and into the BPL versions, and they don't have debug info enabled.

构建了一个测试框架,链接到我的插件静态,所以我可以看到我在做什么,当跟踪通过代码。但现在,每次我尝试重新编译,我得到一个错误:单元turbu_skills编译与不同版本的turbu_database.GDatabase

So I built a testing framework that links to my plugins statically so I can actually see what I'm doing while tracing through the code. But now, every time I try to recompile, I get an error: "unit turbu_skills was compiled with a different version of turbu_database.GDatabase"

我看到这个错误之前,但只有当我一直在改变的东西,我可能不应该有,像RTL或VCL库。我不明白为什么它这样做与我自己的代码。 turbu_skills和turbu_database单元是我自己写的单元。 GDatabase是一个全局单例变量,其类定义我在几周内没有改变。

I've seen this error before, but only when I've been changing things I probably shouldn't have been, like the RTL or VCL libraries. I don't understand why it's doing that with my own code. The turbu_skills and turbu_database units are both units I wrote myself. GDatabase is a global singleton variable, whose class definition I haven't changed in weeks. Any change that triggers a recompile causes this error, even if I haven't touched anything in either of the units.

执行完整构建(SHIFT-F9)会导致此错误导致此错误,即使我没有触及任何单位。以正确编译。但是,如果我随后在单位(任何单位)中按空格,然后按F9,我会再次收到错误。发生了什么,我如何阻止它?这不会发生在主应用程序,只有测试框架。

Doing a full build (SHIFT-F9) causes it to compile correctly. But if I then press SPACE in a unit (any unit) and hit F9, I get the error again. What's going on and how do I stop it? This doesn't happen in the main app, only the testing framework.

编辑:我有我的所有单位的源。删除DCU和类似文件没有帮助。将整个项目复制到其他计算机,删除所有DCU,并在那里建立没有帮助。在我的程序的布局和编译器之间有一个客观的,可重现的冲突,我想摆脱它。

I have the source to all of my units. Deleting DCUs and similar files doesn't help. Copying the entire project to a different computer, deleting all DCUs, and building there doesn't help. There's an objective, reproducible conflict between the layout of my program and the compiler, and I want to be rid of it.

源可以在 http://www.turbu-rpg.com/downloads/Turbu_source_setup.exe 如果有人想要测试它。它需要Delphi 2009与JVCL已经安装;安装程序包将照顾其余的。也许有源代码可用将帮助有人跟踪这。我当然希望如此,因为无论问题在哪里,这是超越我。该问题可以在testing.exe中找到,也可以在turbu.groupproj中的turbu.exe中找到。

The source can be found at http://www.turbu-rpg.com/downloads/Turbu_source_setup.exe if anyone wants to test it. It requires Delphi 2009 with the JVCL already installed; the installer package will take care of the rest. Maybe having the source code available will help someone track this down. I certainly hope so, because wherever the issue is, it's beyond me. The problem can be found in testing.exe and also in turbu.exe in turbu.groupproj.

编辑2:这是另一个跨单元泛型问题。格里。我设法编写一个解决方法。

EDIT 2: Turns out this was another cross-unit generics issue. Grr. I managed to code a workaround. I just hope they get the generics problems fixed soon.

推荐答案

错误单元是使用不同版本的...编译的。 是一个恼人的。它发生在如下情况:

The error "unit is compiled with a different version of..." is an annoying one. It occurs in a situation like below:

     +--------+
     | unit A |
     +--------+
      |      |
      |      |
      V      |
  +--------+ |
  | unit B | |
  +--------+ |
      |      |
      |      |
      V      V
     +--------+
     | unit C |
     +--------+

单位A和B都使用单位C和单元B使用C.单元B和C被编译,并且由于某种原因,单元B的源不可用。现在单元C被改变(任何改变将被改变并被重新编译)并且单元C的dcu与单元B使用的单元C不同,因此单元B需要被重新编译。但不幸的是,源代码不可用,所以编译器放弃。

Both unit A and B use unit C and unit B uses C. Unit B and C are compiled and for some reason the source of unit B is not available. Now Unit C is changed (any change will do and is recompiled) And the dcu of unit C differs from the unit C used by unit B, so unit B needs to be recompiled too. But unfortunately, the source is not available so the compiler gives up.

这不是完全清楚你的情况有什么问题。

It is not entirely clear what's wrong with your situation.

您有一个连接到插件的测试框架。那么单位X和Y在哪里适合,你认识到上面所示的模式?

You have a test framework that links to the plugins. So where do unit X and Y fit in and do you recognize the pattern shown above?

但是,一个完整的构建解决问题的事实是这个方向的暗示。这不是我第一次看到部分重新编译的问题。所以我总是使用完整的版本。

But the fact that a complete build solves the problem is hint in this direction. And this is not the first time I saw problems with partial recompiles. So I always use the complete version.

这篇关于为什么我的单元“用不同的版本编译”的我自己的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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