E2420 Interface '%s' used in '%s' is not yet completely defined (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

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.