积极答复者
MFC关于全局变量的使用问题

问题
-
我利用MFC向导建立了一个基于对话框的程序,
结果生成了一下几个文件:
DataProcess.cpp
DataProcessDlg.cpp
StdAfx.cpp
DataProcess.h
DataProcessDlg.h
StdAfx.h
然后我在DataProcess.h中的类外部声明了一个外部全局变量
extern TAG_FILE_PATH g_myfilepath;(结构体声明在另外一个头文件中,该头文件已经包含在DataProcess.h
文件里)。
然后我在其他类的实现文件中使用g_myfilepath的时候,编译通过,但链接出现错误,为什么?
我在使用之前已经进行了引用性声明了
阿荣
答案
全部回复
-
//Thread.htypedef struct thread_param_s
{
long pos;
long pic_type;
HWND parent;
HANDLE pic;
TCHAR caption[ MAX_PATH ];
TCHAR lab_txt[ MAX_PATH ];
TCHAR ani_path[MAX_PATH];BOOL is_progress_visible;
BOOL is_avi_visible;
} thread_param_t;extern thread_param_t thread_param;
//dowait.cpp#include "Thread.h"thread_param_t thread_param = { 0, 0, 0, 0, 0, 0, 0, TRUE, TRUE };#include "Thread.h"waitdialgo.cppani_ctrl.ShowWindow( thread_param.is_avi_visible ? SW_SHOW : SW_HIDE );
湖北武汉 -