天天看点

mfc 定义全局变量

方法1

在 stdafx.cpp 里定义变量 如:int  temp;

在 stdafx.h 里 extern int temp;//这么做可以防止变量重复定义错误

然后凡是包含 stdafx.h 头文件的cpp里 都可以使用temp全局变量了。