F2047 Circular unit reference to '%s' (Delphi)
Go Up to Error and Warning Messages (Delphi)
One or more units use each other in their interface parts.
As the compiler has to translate the interface part of a unit before any other unit can use it, the compiler must be able to find a compilation order for the interface parts of the units.
Check whether all the units in the uses clauses are really necessary, and whether some can be moved to the implementation part of a unit instead.
unit A; interface uses B; (*A uses B, and B uses A*) implementation end. unit B; interface uses A; implementation end.
The problem is caused because A and B use each other in their interface sections.
unit A; interface uses B; (*Compilation order: B.interface, A, B.implementation*) implementation end. unit B; interface implementation uses A; (*Moved to the implementation part*) end.
Note: This can be fixed in one of two ways:
- You can put the mutually referring classes inside the same unit and use forward declarations to resolve the problems.
- Change the conflicting type to a more general type such as TObject or Pointer and use type casts to the previous type that caused the conflict (this can only be done in the case where the type is used internally.)