为什么会出现如此的错误?(100分)

  • 主题发起人 主题发起人 JebelStream
  • 开始时间 开始时间
J

JebelStream

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure buttonclick();
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}

procedure buttonclick();
begin
beep;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
buttonclick;
end;

错误提示为: Unsatisfiled forward or external declaration:'Tform.buttonclick'
提问:请帮我分析一下错误的原因并提出解决方法。多谢!

 
procedure buttonclick();
begin
beep;
end;
改为:procedure TForm1.buttonclick();
begin
beep;
end;
你漏掉了TForm1.了,哈哈!
 
补充一下,一般增加一个自定义过程,在你声明完过程之后。按CTRL+SHIFT+C就
可以添加过程的实现代码了
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);

private
procedure buttonclick;
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.buttonclick;
begin
beep;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
buttonclick;
end;

end.
 
原来是这样。谢谢你们啦。
哈哈,,,,,
 
后退
顶部