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

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...