Delphi Error – E2128 %s clause expected, but %s found

Delphi Compiler Error

E2128 %s clause expected, but %s found

Reason for the Error & Solution

The compiler was, due to the Delphi language syntax, expecting to find a clause1 in your program, but instead found clause2.

  program Produce;

    type
      CharDesc = class
        vch : Char;

  property Ch : Char;
      end;
  end.

The first declaration of a property must specify a read and write clause, and since both are missing on the ‘Ch’ property, an error will result when compiling. In the case of properties, the original intention might have been to hoist a property defined in a base class to another visibility level – for example, from public to private. In this case, the most probable cause of the error is that the property name was not found in the base class. Make sure that you have spelled the property name correctly and that it is actually contained in one of the parent classes.

  program Produce;

    type
      CharDesc = class
        vch : Char;

  property Ch : Char read vch write vch;
      end;
  end.


The solution is to ensure that all the proper clauses are specified, where required.

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