Delphi Error – E2007 Constant or type identifier expected

Delphi Compiler Error

E2007 Constant or type identifier expected

Reason for the Error & Solution

This error message occurs when the compiler expects a type, but finds a symbol that is neither a constant (a constant could start a subrange type), nor a type identifier.

program Produce;
var
  c : ExceptionClass; (*ExceptionClass is a variable in System*)
begin
end.

Here, ExceptionClass is a variable, not a type.

program Solve;
program Produce;
var
  c : Exception; (*Exception is a type in SysUtils*)
begin
end.

You need to make sure you specify a type. Maybe the identifier is misspelled, or it is hidden by some other identifier, for example from another unit.

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...