Delphi Error – E2086 Type ‘%s’ is not yet completely defined

Delphi Compiler Error

E2086 Type ‘%s’ is not yet completely defined

Reason for the Error & Solution

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.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...