프로 시저를 다른 장치의 프로 시저와 연결하여 주 장치의 양식으로 작업 할 수 없습니다. 이 질문에 언급 된 바와 같이 인터페이스 아래에 프로 시저 선언을 추가하려고 시도했지만 How to run procedure from another unit?, 작동하지 않습니다. E2003 선언되지 않은 식별자 :이 [DCC 오류] Main.pas (27)를 도시 유지 'sayHi'여기서되는 코드 모두 단위 : Main.pas :델파이의 다른 장치에서 프로 시저가 선언되지 않은 식별자를 표시합니다.
unit Main;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Unit2;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
sayHi();
end;
end.
및 Unit2.pas
여기program gl;
uses
Vcl.Forms,
Main in 'Main.pas' {Form1},
Unit2 in 'Unit2.pas';
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
가 main.dfm 파일입니다 :
여기
unit Unit2;
interface uses Dialogs;
procedure sayHi();
implementation
procedure sayHi();
begin
ShowMessage('hi');
end;
end.
는 프로젝트에 대한 조선 민주주의 인민 공화국 파일입니다
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 444
ClientWidth = 621
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
end
문제의 코드는 –
입니다. 그러면 다른 문제가있을 수 있습니까? –
실제로 진행되고있는 것을 재현하지 않습니다 –