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.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!