E2128 %s clause expected, but %s found (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

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.