unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Label1: TLabel;
    function SmallTOBig(small:Double):string;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public  end;var
  Form1: TForm1;
  samll:Double;
implementation{$R *.dfm}function SmallTOBig(small:Double):string;
begin
   SmallTOBig:=floattostr(samll);
   end;
  procedure TForm1.Button1Click(Sender: TObject);begin
Label1.Caption:=SmallTOBig(strtofloat(Edit1.Text));
end;end.
以下是出错信息:
[Error] Unit1.pas(36): Undeclared identifier: 'samll'
[Error] Unit1.pas(14): Unsatisfied forward or external declaration: 'TForm1.SmallTOBig'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

解决方案 »

  1.   

    将function SmallTOBig(small:Double):string;
    改为:
    function TForm1。SmallTOBig(small:Double):string;
    试试
      

  2.   

    将function SmallTOBig(small:Double):string;
    改为:
    function TForm1.SmallTOBig(small:Double):string;
    试试
      

  3.   

    TForm1.SmallTOBig(small:Double):string;
      

  4.   

    function TForm1.SmallTOBig(small:Double):string;
    begin
      SmallTOBig:=floattostr(samll);
    end;
      

  5.   

    在private下写:
    function SmallTOBig(small:Double):string;
    然后改函数体:function TForm1.SmallTOBig(small:Double):string;
    begin
       SmallTOBig:=floattostr(samll);
       end;
      

  6.   

    补充
    type
      TForm1 = class(TForm)
        Edit1: TEdit;
        Button1: TButton;
        Label1: TLabel;
        function SmallTOBig(small:Double):string;//此行去掉
      

  7.   

    不要用small
    可改为
    function SmallTOBig(aa:Double):string;
    begin
       SmallTOBig:=floattostr(aa);
       end;function SmallTOBig(small:Double):string;//此行去掉
    运行没问题
      

  8.   

    说错了,与“不要用small”无关,刚可能是机子出了点问题:)