E2232 Interface '%s' has no interface identification (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

You have attempted to assign an interface to a GUID type, but the interface was not defined with a GUID.


program Produce;

  type
    IBase = interface
    end;

  var
    g : TGUID;

  procedure p(x : TGUID);
  begin
  end;

begin
  g := IBase;
  p(IBase);
end.

In this example, the IBase type is defined but it is not given an interface, and is thus cannot be assigned to a GUID type.


program Solve;

  type
    IBase = interface
    ['{00000000-0000-0000-0000-000000000000}']
    end;

  var
    g : TGUID;

  procedure p(x : TGUID);
  begin
  end;

begin
  g := IBase;
  p(IBase);
end.

To solve the problem, you must either not attempt to assign an interface type without a GUID to a GUID type, or you must assign a GUID to the interface when it is defined. In this solution, a GUID has been assigned to the interface type when it is defined.