Why are my units “compiled with a different versio

2019-01-24 05:39发布

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.

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"

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.

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.

EDIT: 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.

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.

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.

14条回答
Emotional °昔
2楼-- · 2019-01-24 06:18

Unit ppParameter was compiled with a different version of ppRelatv. TppRelative :

Delete all .dcu in your program folder / your computer, then re-compile or re-build again. Then your program will running well again.

查看更多
地球回转人心会变
3楼-- · 2019-01-24 06:18

I just had the same error message in Delphi XE. Mine was solved after closing Delphi, opening it again and recompiling my project.

查看更多
Juvenile、少年°
4楼-- · 2019-01-24 06:21

For future reference, simply pointing the compiler to source-code versions of the "problem units" fixed this for me (i.e. adding the folders containing the source code to the search path).

查看更多
Summer. ? 凉城
5楼-- · 2019-01-24 06:23

For me the problem was that I installed Delphi with minimum required components. And when I opened a project that was compiled with full Delphi installation it happened to me. Coping the files in the "Source" folder in Delphi installation folder from another machine with full Delphi installation solved my problem.

查看更多
Fickle 薄情
6楼-- · 2019-01-24 06:24

I hate this problem. I find it pops up every now and then and although it sounds in your case to be directly related to what you are doing with plugins, I've solved this in the past by finding and deleting all the dcus, bpls and dcps of the packages that we've written and then rebuilding the packages.

查看更多
Animai°情兽
7楼-- · 2019-01-24 06:24

How I solved the 'path madness' in Delphi XE7:

  Rule1: Always separate the DCU from the PAS files

  Tools -> Option -> Library path: 
                 Path to global (3rd party) libraries (DCU folder) that never change.

                    c:\Delphi\Tools\FastMM\
                    c:\MyProjects\Packages\Third party packages\$(Platform)
                    c:\MyProjects\Packages\DragDrop\$(Platform)
                    c:\MyProjects\Packages\Graphics32\$(Platform)

  Project -> Options -> Search path: 
                 Path to personal libraries, that changes often. 
                 Enter the path to the DCU folder first, then path to PAS file. 
                 This way, the compiler will use the DCU files first, instead of recomilin every time from PAS files. 
                 It will recompile anyway if you do a Build.

                    c:\MyProjects\Packages\cCommonControls\$(Platform)_$(Config)
                    c:\MyProjects\Packages\cCommonControls\

  Project -> Options -> Output directory: 
                 Leave it empty so the exe file is generated in project's folder 

  Project -> Options -> DCU output directory: 
                 Use .\$(Platform)_$(Config) in order to enforce Rule1
查看更多
登录 后发表回答