unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  c=class
    k:integer;
  end;
var
  Form1: TForm1;
   a:c;
implementation{$R *.dfm}
  a:=c.create;end.
运行的时候总说a:=c.create;这一句有错,但为什么改成这样就能运行?
program Project2;{$APPTYPE CONSOLE}uses
  SysUtils;
type c=class
       k:integer;
     end;
var a:c;begin
  { TODO -oUser -cConsole Main : Insert code here }
  a:=c.Create ;
end.

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;
    type    //这样试一下
      c=class
        k:integer;
      end; 
    type
      TForm1 = class(TForm)
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    var
      Form1: TForm1;
       a:c;
    implementation{$R *.dfm}
      a:=c.create;end.
      

  2.   

    就像用C++编写window程序时一定要有WinMain做入口函数,这个
    begin
    //
    end;
    就相当于WinMain,不能少!
      

  3.   

    我知道了,是不是implementation下面少了个begin