如题:

解决方案 »

  1.   

    unit1中的函数必须在接口部分声明。
    unit2需要uses unit1,然后在代码中调用。
      

  2.   

    unit1里把函数定义为public类型的
    unit2里 use unit1
    然后form2.函数就可以用了啊。
      

  3.   

    uses Unit1;然后:Form2.就会自动出来了...
      

  4.   

    定义在public里面,然后uses就行了
      

  5.   

    unit Unit2;interface
    uses dialogs;procedure hello;implementationprocedure hello;
    begin
      ShowMessage('hello world');
    end;end.
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
    uses unit2;
    {$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      hello;
    end;end.
      

  6.   

    如果是系统的单元文件,直接在uses后面添加如果是自定义的单元文件,需要互相使用的话,就在implementation之后uses添加一下要使用的单元文件名
      

  7.   

    我在unit1的public中声明unit2中要调用的函数TexToBuf后,编译有eror:unsatisfied forword or extrnal declaration:'TFORM1.TexToBuf'.可是我并没有找到其他地方的声明。这是怎么回事呀?
      

  8.   

    unit1里把函数定义为public类型的 
    unit2里 use unit1 
    然后form2.函数 的形式调用unit1里面的函数
      

  9.   

    请教:我在unit1的public中声明unit2中要调用的函数TexToBuf后,编译有eror:unsatisfied forword or extrnal declaration:'TFORM1.TexToBuf'.可是我并没有找到其他地方的声明。这是怎么回事呀?
      

  10.   

    8楼写的似乎是uint1调用uint2,而非uint2调用uint1?是这样吧?
      

  11.   


    在你的函数前面加上TForm1.
      

  12.   

    你好,請先use unit2,然後使用請用form2.,即可參考到你要的form2內的東西了。
      

  13.   

    这么看来,是不需要在public中声明函数了,只要在需要调用的unit中写上used+调用的unit即可?
      

  14.   


    差不多,在要调用的unit中的implementation下写uses + 调用的unit名字,就可以调用其中的属性、方法
      

  15.   

    楼主,你这样学习态度可不行啊,uint1和uint2只不过是个名称,你应该在大学给你讲解和指导的同时,进行思考,不明白的地方先去找书去看看,然后再来问。