jeudi 3 septembre 2015

E2003 Undeclared identifier: 'ITestInterfataUnit'

It looks like a silly question, but I've been struggling with it for some time. I have two units. One is a unit with an declared interface and the other one is a Form that I would like to implement that interface. Code:

unit ITestInterfata;

interface


implementation

 type
  ITestInterfataUnit = interface
    ['{A0CD69F8-C919-4D2D-9922-A7A38A6C841C}']

    procedure Intrare(s : string);
  end;

end.

Main form unit:

unit frameTestInterfata;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, ITestInterfata;



type
  TformaTestInterfata = class(TForm, ITestInterfataUnit)
    Button1: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
    procedure Intrare(s: string);
  end;

var
  formaTestInterfata: TformaTestInterfata;

implementation

{$R *.dfm}


{ TformaTestInterfata }

procedure TformaTestInterfata.Intrare(s: string);
begin
  ShowMessage('asdf');
end;

end.

If I use the CTRL+Click on ITestInterfataUnit it takes me to the right unit in the right place. I've seen a problem like that being discuss here and I've tried everything I saw as a solution there. - create the project again - close and open the Delphi IDE - check if the interface unit is declare in uses in main form - made sure that I gave a name to the unit so there would be no other .dcu's with the same name.

Any help would be great!

Aucun commentaire:

Enregistrer un commentaire