F2051 Unit JclUnitVersioning was compiled with a different version of System.Contnrs.TObjectList.Remove

北城以北 提交于 2020-01-03 03:07:06

问题


I'm migrating a Delphi 2 project to RAD Studio XE2.

When I try to compile I get

[DCC Fatal Error] MyUnit.pas(9): F2051 Unit JclUnitVersioning was compiled with a different version of System.Contnrs.TObjectList.Remove

at the following row:

unit MyUnit;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, DB, DBTables, TB97, ExtCtrls, Grids, DBGrids, Vcl.Mask, JvExMask,
  Vcl.DBLookup,
  JvToolEdit,  {<-- error here}
  TB97Ctls;

{...}

I tried uninstalling and reinstalling RAD Studio, JCL and JVCL, but nothing changes.

Update Was using the binary Jedi installer from A.Hausladen (intended for use in Delphi trial editions only).


回答1:


You either have old DCU files lying around that need to be rebuilt, or removed, or your project or library path contents are not consistent. (Find files named JclUnitVersioning.dcu that are not in the proper JCL Library folder, and remove them. The proper library folders are named jcl\lib\d7, through jcl\lib\d16, depending on your delphi version number )

This usually means that your project has access to both a directory that is in your library-path (or project search path) that contains pre-compiled DCU files, and may also have access to some source units (.pas files), and that one or more of the units that depends on other units, was compiled at a different time than now, with multiple versions of a common unit. I wish I could draw you a picture.

Imagine you have a car, and someone upgrades the engine, changing it from a V6 to a V8. Now someone who had previously been servicing your engine comes back and tries to find the place where the V6's exhaust manifold attached. It's not there any more, it's moved. Since the new engine is frozen in its current shape (stay with me here!), your service technician simply goes back to you (the customer) and says, "sorry, I'm confused, I can't continue, I give up". That's roughly what this error message means.

Cleaning it up is possible in several ways; It may be a simple matter for you to make sure you compile 100% from .pas files, and have no Library folders containing .dcu files at all. Of course, that's hardly ideal, is it, since the whole purpose of a Library path was to contain a precompiled "library" of DCU files.

So instead, I suggest you do a cleanup (delete all your DCU files) and rebuild all your component packages from source (you do have a batch file for that purpose right?) and then review both your project's search path, and library path to see that both contain only the folders you think they should contain.




回答2:


Just had the same problem with Delphi 2010 and XE3 (both on same PC while migrating).

After several hours of recompiling both my projects and the JCL projects (the installer bat file errors on my PC) discovered the problem was the order in which the directories were declared in the tools/options/Delphi Options/libraries.

Took them all out, added the version specific directory (eg lib\D14, lib\D17\Win32) and then the other JCL sub-directories required (ie one at a time until a project using JCL would build)



来源:https://stackoverflow.com/questions/10089869/f2051-unit-jclunitversioning-was-compiled-with-a-different-version-of-system-con

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!