Delphi Error – E2265 Interface ‘%s’ not mentioned in interface list

Delphi Compiler Error

E2265 Interface ‘%s’ not mentioned in interface list

Reason for the Error & Solution

An implements clause references an interface which is not mentioned in the interface list of the class.

program Produce;
type
  IMyInterface = interface
  end;

  TMyClass = class(TInterfacedObject, IUnknown)
    FMyInterface: IMyInterface;
    property MyInterface: IMyInterface read FMyInterface implements IMyInterface;
  end;
end.


The example shown here uses implements with the IMyInterface interface, but it is not mentioned in the interface list.

program Solve;
type
  IMyInterface = interface
  end;

  TMyClass = class(TInterfacedObject, IUnknown, IMyInterface)
    FMyInterface: IMyInterface;
    property MyInterface: IMyInterface read FMyInterface implements IMyInterface;
  end;
end.


A quick solution, shown here, is to add the required interface to the interface list of the class definition. Of course, adding it to the interface list might require the implementation of the methods of the interface.

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