Search code examples
delphivcldelphi-2007

How to include Vcl.ImgList in Delphi


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?


Solution

  • 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.