depphi中错误[dcc32 Error] FMainForm.pas(107): E2065 Unsatisfied forward or external declaration: ‘TFrmMainForm.Delay’

depphi中错误[dcc32 Error] FMainForm.pas(107): E2065 Unsatisfied forward or external declaration: ‘TFrmMainForm.Delay’

如下原因造成的:

类声明部分定义的procedure Delay(dwMilliseconds: Longint);在实现部分需要有类名的全称!

procedure Delay(dwMilliseconds: Longint);//这样是错误的
var
  iStart, iStop: DWORD;
begin
  iStart := GetTickCount;
  repeat
    iStop := GetTickCount;
    Application.ProcessMessages;
    Sleep(1); // addition from Christian Scheffler to avoid high CPU last
  until (iStop - iStart) >= dwMilliseconds;
end;


//应该是这样:要有类名的全称
procedure TFrmMainForm.Delay(dwMilliseconds: Longint);
var
  iStart, iStop: DWORD;
begin
  iStart := GetTickCount;
  repeat
    iStop := GetTickCount;
    Application.ProcessMessages;
    Sleep(1); // addition from Christian Scheffler to avoid high CPU last
  until (iStop - iStart) >= dwMilliseconds;
end;

发表评论

电子邮件地址不会被公开。 必填项已用*标注