HomeDelphiDelphi Error – E2005 ‘%s’ is not a type identifier

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

Delphi Compiler Error

E2005 ‘%s’ is not a type identifier

Reason for the Error & Solution

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.

Share:

Leave a Reply

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...