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

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