Search code examples
delphipropertiesindy

dcc32 Error x.pas(648): E2003 Undeclared identifier: 'x'


So I've tried to add two properties to unit IdMessage.pass. So i've added

  TIdMessage = class(TIdBaseComponent)
  private
    FTaskID: Integer;
    FNotificationID: Integer;
  protected
   ... all protected properties and procedures


  public

   ... all protected procedures and functions

    property TaskID : Integer read FTaskID write FTaskID;
    property NotificationID : Integer read FNotificationID write FNotificationID;

  published

    ...published properties
  End;

The unit looks Ok, but when I try to compile a project that uses these two properties I get the Undeclared identifier error. I have no idea why. If I CTRL+CLICK the property at design time, it takes me to the property in the unit, but when I try to build or compile it runs into this error. Any suggestions?


Solution

  • Despite what you say in the comments, you are modifying third party code. In effect you are making a fork. The compiler error is just the first symptom of the trouble that lies ahead. The compiler is not using the code that you have written. The compiler is using a different version.

    For sure you can make the fork work by ensuring that the compiler uses your fork rather than the original code. However, you are setting yourself up for a fall. Next time you upgrade Indy, what will happen? Will you be able to merge your fork into the new Indy?

    If forking is the best solution, so be it. But it almost certainly is not. We don't know what your actual problem is but forking seems unlikely to be the best way forward. Try to find a design that allows you not to modify the Indy code.