uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs;
type
  TForm2 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  php:integer;//声明全局变量
  Form2: TForm2;
implementation
********************************************************
 然后在其他单元中引用全局变量所在的单元: uses unitx
********************************************************

解决方案 »

  1.   

    我在另一个窗体是这样设置的。implementation 
    uses unitx把uses unitx写在了implementation 下面, 但这样行不通
      

  2.   

    比如在unit2的单元中定义全局变量
    myvar:integer;
    那么在unit1的interface下面的uses中加入unit2,
    然后在unit1中就可以用myvar了,如:
    unit2.myvar:=5;
      

  3.   

    放在
    implementation 
    uses unitx 
    调用一个单元
    和在interface下面的uses加入unitx 有什么不同
      

  4.   

    unit Unit11;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, DB, DBTables;
    var
      str_Create_SQL:string;
      int_Checked:integer;//全局
    type
      TQuery_Form = class(TForm)
        Panel1: TPanel;
        BitBtn1: TBitBtn;
        Bevel1: TBevel;
        GroupBox1: TGroupBox;
        Edt_gdsyh: TEdit;
        Edt_dsr: TEdit;
        Date_gzrq: TDateTimePicker;
        Edt_gzsx: TEdit;
        CheckBox_gdsyh: TCheckBox;
        CheckBox_dsr: TCheckBox;
        CheckBox_gzrq: TCheckBox;
        CheckBox_gzsx: TCheckBox;
        ComboBox1: TComboBox;
        ComboBox2: TComboBox;
        ComboBox3: TComboBox;
        ComboBox4: TComboBox;
        Label1: TLabel;
        ComboBox5: TComboBox;
        BitBtn2: TBitBtn;
        Query1: TQuery;
        procedure CheckBox_gdsyhClick(Sender: TObject);
        procedure CheckBox_dsrClick(Sender: TObject);
        procedure CheckBox_gzrqClick(Sender: TObject);
        procedure CheckBox_gzsxClick(Sender: TObject);
        procedure BitBtn2Click(Sender: TObject);
        procedure BitBtn1Click(Sender: TObject);
      private
        { Private declarations }
        procedure Create_SQL();
        procedure Condition_SQL(str_text,str_con:string);
      public
        { Public declarations }
      end;var
      Query_Form: TQuery_Form;implementation
    uses unit2,unit10,unit4;
    {$R *.dfm}
      

  5.   

    在你说的这种情况下没有不同,都可以调试成功!
    不过当两个互相引用时就要注意:
     如果在unit1的interface下的uses引用了unit2,那么在unit2中必须在implementation 下面引用unit1!另外在声明变量是会用所不同,在inplementation中声明的变量只能在本单元中有效,在其他单元中无效,即使在其他单元中引用本单元!