天天看點

mfc 定義全局變量

方法1

在 stdafx.cpp 裡定義變量 如:int  temp;

在 stdafx.h 裡 extern int temp;//這麼做可以防止變量重複定義錯誤

然後凡是包含 stdafx.h 頭檔案的cpp裡 都可以使用temp全局變量了。