Delphi – E2005 ‘%s’ is not a type identifier

This error message appears when the compiler expects the name of a type but finds a name that does not exist.

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

procedure Proc(C: MyClass);           
begin
end;

begin
end.

The type of the argument in the example is incorrectly identified as the name of the variable rather than the name of the type.

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

procedure Proc(C: TMyClass);
begin
end;

begin
end.

Check to see if the offending identifier is a type – it could be misspelt, or another identifier with the same name is hiding the one you’re looking for.

%d bloggers like this: