Delphi Error – E2019 Object type required

Delphi Compiler Error

E2019 Object type required

Reason for the Error & Solution

This error is given whenever an object type is expected by the compiler. For instance, the ancestor type of an object must also be an object type.

type
  MyObject = object(TObject)
  end;
begin
end.

Confusingly enough, TObject in the unit System has a class type, so we cannot derive an object type from it.

program Solve;
type
  MyObject = class  (*Actually, this means: class(TObject)*)
  end;
begin
end.

Make sure the type identifier really stands for an object type – maybe it is misspelled, or maybe is hidden by an identifier 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 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...