c++全局变量的使用方式 在cpp文件中定义在头文件中定义 在cpp文件中定义 主函数中的使用: extern int aa; extern int bb; 在头文件中定义 在主函数中: 在*.h文件中声明(需要加extern关键字),在*.cpp文件中定义。