关于网友提出的“ 帮我看看自义定函数怎么会出错?”问题疑问,本网通过在网上对“ 帮我看看自义定函数怎么会出错?”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 帮我看看自义定函数怎么会出错?
描述: 为什么我自定义函数老是不成功
我把 function is_numeric(str:string):boolean; 放在private 下面
把函数体放在过程前面
function is_numeric(str:string):boolean;
begin
……
end;
报错:Unsatisfied forward or external declaration
解决方案1: private
function is_numeric(str:string):boolean;
{ Private declarations }
============================
{$R *.dfm}
function Tform1.is_numeric(str:string):boolean;
begin
result:=true;
end;
就样的
行了没有呀?
解决方案2: 找本书看看
一般都有介绍的
解决方案3: 你在接口(interface)里面有没有定义?
解决方案4: 不用在interface中定义,否则就不是tform的一个方法了
解决方案5: type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
function is_numeric(str:string):boolean;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function Tform1.is_numeric(str:string):boolean;//这里一定要有:Tform1.
begin
result:=true;
end;
解决方案6: meiqingsong(阿飞)说的是对得
解决方案7: function is_numeric(str:string):boolean;
上边缺少;之类的
解决方案8: TForm1 = class(TForm)
private
function is_numeric(str:string):boolean;
public
end;
function TForm1.is_numeric(str:string):boolean; //加入TForm1
begin
……
end;
以上介绍了“ 帮我看看自义定函数怎么会出错?”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2540333.html