2006-12-16 15:50
Jason_steven
请教各位高手,我的一个Delphi程序怎么不能编译啊?
[size=5]编译Unit1.pas时,出现如下编译错误:
[Fatal Error] Unit1.pas(7): Could not compile used unit 'Unit2.pas'
[Fatal Error] Unit1.pas(7): Could not compile used unit 'D:\Delphi_Study\Unit2.pas'
望各位高手不吝赐教啊!!Thank you!
--------------------------------------------------------------------------
[/size][size=5][color=red]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Unit2;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Date: TDate;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Date: TDate;
begin
Date := TDate.create;
Date.SetValue(1,1,2000);
if Date.LeapYear then
ShowMessage('闰年:' + Inttostr(Date.year));
Date.free;
end;
end.
unit Unit2;
interface
USES
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ADODB, DB,strUtils;
Type
TDate=class(Tobject)
Month,Day,Year:Integer;
public
procedure SetValue(m,d,y:Integer);
function LeapYear:Boolean;
end;
implementation
procedure TDate.SetValue(m,d,y:Integer);
begin
Month := m;
Day := d;
Year := y;
end;
function TDate.LeapYear:Boolean;
begin
if (Year mod 4 <> 0) then
LeapYear := False
else if (Year mod 100 <> 0)
LeapYear := True
else if (Year mod 400 <> 0)
LeapYear := False
else
LeapYear := True;
end;
end.[/color][/size]