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.