0

In compiling a Delphi 2007 project, I receive the following error:

E203: Undeclared identifier: TChangeLink

This appears to belong to the Vcl > ImgList library.

My limited understanding is that Vcl is part of the native Delphi libraries. How do I verify that it is correctly referenced?

Ken White
  • 123,280
  • 14
  • 225
  • 444
ljs.dev
  • 4,449
  • 3
  • 47
  • 80
  • 1
    You're missing `ImgList` in the uses clause, if it's Delphi code you're compiling. . – Ken White Sep 08 '15 at 23:45
  • uses contains this line: `Clipbrd{$IFDEF DELPHI4}, ImgList {$ENDIF}, dxCommon{$IFDEF DELPHI6}, Variants{$ENDIF}`. Taking ImgList out of the conditional overcame this issue, thanks! Feel free to post it as an answer – ljs.dev Sep 08 '15 at 23:51

1 Answers1

1

It's because ImgList isn't in your uses clause. Based on information you provided in a comment,

uses contains this line:

Clipbrd{$IFDEF DELPHI4}, ImgList {$ENDIF}, dxCommon{$IFDEF DELPHI6}, Variants{$ENDIF}

It's because the {$IFDEF DELPHI4} is excluding it, presumably because DELPHI4 isn't defined. This is typically caused by using code that is in open-source or commercial component sets that use those version defines to support multiple Delphi versions with the same source. (This is usually done in a .INC file of some sort; Jedi uses JEDI.INC, for instance, for all of the version defines for various compiler and IDE related differences.)

The best solution (to maintain cross-version compatibility) would be to update the definitions to include Delphi 2007, but I can't offer advice on how to do so because I don't know where the define is located. The other alternative is to just remove the {$IFDEF DELPHI4} from the uses clause, if you don't need to worry about earlier versions of the IDE/compiler.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Ken White
  • 123,280
  • 14
  • 225
  • 444
  • 1
    A conditional named like `DELPHI4` is likely being defined (by a third-party `.inc`) only for Delphi 4 exclusively, not for Delphi 4 and later versions. Usually, third-party library vendors will define conditionals like `DELPHI4ANDHIGHER` or `DELPHI4ORLATER` or similar for later versions, then the `uses` clause could like like: `uses ...{$IFDEF DELPHI4ORLATER}, ImgList{$ENDIF}...;`. Of course, this was before Delphi 6 introduced `{$IF}` and `RTLVersion`, which you really should be using instead. – Remy Lebeau Sep 09 '15 at 01:31
  • @Remy: I know of one commercial library that uses `{$IFDEF VERxxx} {$DEFINE DELPHIx}` in it's product, extending it with every new version of the compiler (occasionally poorly). I don't know where the define came from in the code in question, but as `ImgList` was introduced in D4 and is still around in at least D2007 (according to the documentation), I'd suspect that's the case here. – Ken White Sep 09 '15 at 01:40
  • 1
    A lot of libraries still use that method (Indy does, for instance, though I do have experimental code to eventually move Indy away from that model). – Remy Lebeau Sep 09 '15 at 01:48
  • 1
    Although you can use RTLVersion, the fact remains that the compiler and RTL versions are less memorable and less recognisable (albeit technically equally meaningful). So even if you do choose to use RTLVersion/CompilerVersion (only possible if you don't need to support pre-Delphi 6 code, which you may be surprised to learn there is still a lot of!) I would still use them only to **$define** more relatable symbols to allow (e.g.) **$ifdef DELPHI2009_OR_LATER** which is instantly more understandable than **$IF RTLVersion >= 20** – Deltics Sep 09 '15 at 07:34