mfc 定义全局变量

来源:互联网 发布:php上传图片插件 编辑:程序博客网 时间:2024/05/16 00:51

方法1

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

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

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