大虾救命,超级简单的问题:theApp为什么不能再别的Class Function里被呼叫?
我用mfc做好各Dialog based框架:Project name: JobAlloc,添加了个新的class。
调试显示出错:
E:\myproject\JobAlloc\AxDCommandLineInfo.cpp(33) : error C2065: 'theApp' : undeclared identifier
theApp为什么不能再别的Class Function里被呼叫?theApp不是Globals的么?
大虾救命
/////in JobAllocApp.h //////////////////////////////
class CJobAllocApp : public CWinApp
{
public:
CString m_strName;
.....
/////in JobAllocApp.cpp //////////////////////////////
CJobAllocApp theApp;
.....
/////in AxDCommandLineInfo.h ///////////////////////
class CAxDCommandLineInfo : public CCommandLineInfo
{
public:
CAxDCommandLineInfo();
~CAxDCommandLineInfo();
void Test();
};
/////in AxDCommandLineInfo.cpp /////////////////////
#include "stdafx.h"
#include "JobAlloc.h"
#include "AxDCommandLineInfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#endif
//////////////////////////////////////////////////////////////////////
// Konstruktion/Destruktion
//////////////////////////////////////////////////////////////////////
CAxDCommandLineInfo::CAxDCommandLineInfo()
{
}
CAxDCommandLineInfo::~CAxDCommandLineInfo()
{
}
//////////////////////////////////////////////////////
void Test()
{
theApp.m_strName = CString(" ");
};