E2005 '%s' is not a type identifier (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

This error message occurs when the compiler expected the name of a type, but the name it found did not stand for a type.


program Produce;
type
  TMyClass = class
    Field: Integer;
  end;
var
  MyClass: TMyClass;

procedure Proc(C: MyClass);           (*<-- Error message here*)
begin
end;

begin
end.

The example erroneously uses the name of the variable, not the name of the type, as the type of the argument.


program Solve;
type
  TMyClass = class
    Field: Integer;
  end;
var
  MyClass: TMyClass;

procedure Proc(C: TMyClass);
begin
end;

begin
end.

Make sure the offending identifier is indeed a type - maybe it was misspelled, or another identifier of the same name hides the one you meant to refer to.