E2086 Type '%s' is not yet completely defined (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

This error occurs if there is either a reference to a type that is just being defined, or if there is a forward declared class type in a type section and no final declaration of that type.


program Produce;

type
  TListEntry = record
    Next: ^TListEntry;                      (*<-- Error message here*)
    Data: Integer;
  end;
  TMyClass = class;                         (*<-- Error message here*)
  TMyClassRef = class of TMyClass;
  TMyClasss = class                         (*<-- Typo ...*)
    (*...*)
  end;

begin
end.

The example tries to refer to record type before it is completely defined. Also, because of a typo, the compiler never sees a complete declaration for TMyClass.


program Solve;

type
  PListEntry = ^TListEntry;
  TListEntry = record
    Next: PListEntry;
    Data: Integer;
  end;
  TMyClass = class;
  TMyClassRef = class of TMyClass;
  TMyClass = class
    (*...*)
  end;

begin
end.

The solution for the first problem is to introduce a type declaration for an auxiliary pointer type. The second problem is fixed by spelling TMyClass correctly.