HomeDelphiDelphi Error – E2420 Interface ‘%s’ used in ‘%s’ is not yet completely defined

Delphi Error – E2420 Interface ‘%s’ used in ‘%s’ is not yet completely defined

Delphi Compiler Error

E2420 Interface ‘%s’ used in ‘%s’ is not yet completely defined

Reason for the Error & Solution

Interface used in is not yet completely defined. Forward declared interfaces must be declared in the same type section that they are used in. As an example the following code will not compile because of the above error message:

program Project3;

{$APPTYPE CONSOLE}

type
  TInterface = interface;

  TFoo = class
    type
      TBar = class(TObject, TInterface)
        procedure Bar;
      end;
  end;

  TInterface = interface
    procedure Intf;
  end;

procedure TFoo.TBar.Bar;
begin

end;

begin
end.

Share:

Leave a Reply

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...