全局变量。
如:
int g_iParam = 0; // 变量定义
extern int g_iParam; // 引用该变量的文件中使用

解决方案 »

  1.   

    另外-声明处也可以使用extern修饰符
    其它同意jimconrad(jimmy)。
      

  2.   

    ////////////////////////////
    // global.h
    // extern int g_iParam;  // declare the parameter//------------------------------end of the file////////////////////////////
    // global.cpp
    //int g_iParam = 0;  // define the parameter//-----------------------------end of the file
    ////////////////////////////////
    // CMyDialog.cpp
    //#include "CMyDialog.h"
    #include "global.h"
    // ... other codesextern int g_iParam; // declare the parametervoid CMyDialog::OnMessage()
    {
        g_iParam = 1; // access the parameter.
    }...//-------------------------------- end of this file
      

  3.   

    CMyDialog.cpp文件中下面这一行可以不用了,因为有了#include "global.h":extern int g_iParam; // declare the parameter