Error: No matching implementation for interface method “IUnknown.QueryInterface(constref TGuid,out ):LongInt; StdCall;” found

Error was observed when class implements some interface.

type
    TDataSource = class(IGridDataSource)
    public
    ...

Compiler messages

Сообщения, предупреждений: 1
Warning: other unit files search path (aka unit path) of "Examples" 
contains "C:\lazarus\components\ideintf", 
which belongs to package "IDEIntf"
Компиляция проекта, цель: bin\Examples.exe: Код завершения 1, ошибок: 3
examplesmain.pas(18,19) Error: No matching implementation for interface 
method "IUnknown.QueryInterface(constref TGuid,out ):LongInt; 
StdCall;" found
examplesmain.pas(18,19) Error: No matching implementation for interface 
method "IUnknown._AddRef:LongInt; StdCall;" found
examplesmain.pas(18,19) Error: No matching implementation for interface 
method "IUnknown._Release:LongInt; StdCall;" found

Solution

Add inheritance from TInterfacedObject
type
    TDataSource = class(TInterfacedObject, IGridDataSource)
    public
    ...

Reference

 

Advertisements