unit1的代码:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Edit1: TEdit;
    Button1: TButton;
    Memo1: TMemo;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
{ Public declarations }
starttime:tdatetime;
thread1:tmyfirstthread;
procedure thread1done(sender:tobject);
  end;var
  Form1: TForm1;implementation{$R *.dfm}
procedure tform1.thread1done(sender:tobject);
var totalmillisecond:integer;
begin
totalmillisecond:=millisecondsbetween(starttime,now);
label1.caption:=inttostr(totalmillisecond);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
starttime:=now;
thread1:=tmyfirstthread.create(false);
thread1.priority:=tpnormal;
thread1.onterminate:=thread1done;
thread1.freeonterminate:=true;
end;end.
unit2的代码:unit Unit2;interfaceuses
  Classes,unit1,sysutils;type
  tmyfristthread = class(TThread)
  private
    { Private declarations }
     sum:extended;
     procedure updatecaption;
  protected
    procedure Execute; override;
  end;implementation{ Important: Methods and properties of objects in visual components can only be
  used in a method called using Synchronize, for example,      Synchronize(UpdateCaption);  and UpdateCaption could look like,    procedure tmyfristthread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }{ tmyfristthread }
 procedure tmyfirstthread.updatecaption;
 begin
 form1.edit1.text:=floattostr(sum);;
 end;
procedure tmyfristthread.Execute;
  { Place thread code here }
  var
  i,j:integer;
begin
sum:=0;
for i:=0 to 10000 do
begin
for j:=0 to 10000 do
begin
sum:=sum+(i+j);
  end;
  if terminated then exit;
  synchronize(updatecaption);
  end;
end;
end.
始终要抱错,是怎么回事?
[Error] Unit1.pas(23): Undeclared identifier: 'tmyfirstthread'
[Error] Unit1.pas(36): Undeclared identifier: 'millisecondsbetween'
[Error] Unit1.pas(42): Missing operator or semicolon
[Error] Unit1.pas(42): Incompatible types: 'TComponent' and 'Boolean'
[Error] Unit1.pas(43): Missing operator or semicolon
[Error] Unit1.pas(44): Missing operator or semicolon
[Error] Unit1.pas(44): Not enough actual parameters
[Error] Unit1.pas(45): Missing operator or semicolon
[Fatal Error] Project1.dpr(6): Could not compile used unit 'Unit1.pas'