VC++ 深入浅出MFC的问题

来源:百度知道 编辑:UC知道 时间:2024/05/24 21:25:04
#include<iostream.h>

class CObject;

struct CRuntimeClass
{
LPCSTR m_lpszClassName;
int m_nObjectSize;
UINT m_wSchema;
CObject* (PASCAL* m_pfnCreateObject)();
CRuntimeClass* m_pBaseClass;

static CRuntimeClass* pFirstClass;
CRuntimeClass* m_pNextClass;
};

struct AFX_CLASSINIT
{ AFX_CLASSINIT(CRuntimeClass* pNewClass); };

#define RUNTIME_CLASS(class_name)
( &class_name::class##class_name)

#define DECLARE_DYNAMIC(class_name)
public:
static CRuntimeClass class##class_name;
virtual CRuntimeClass* GetRuntimeClass() const;

#define _IMPLEMENT_RUNTIMECLASS(class_name,base_class_name,wSchema,pfnNew)
static char _lpsz##class_name()= #class_name;
CRuntimeClass class_name::class##class_name={
_lpsz##class_name, sizeof(class_name),wSchema,pfnNew,
RUNTIME_CLASS(base_class_name),NULL);
static AFX_CLASSINIT _ini

l:\程序\练习\mfc.h(11) : error C2144: syntax error : missing ';' before type 'CObject'
是说,你的头文件mfc.h的第十一行,有语法错误,即在CObject之前,缺少了一个分号;。
l:\程序\练习\mfc.cpp(55) : error C2146: syntax error : missing ';' before identifier '_IMPLEMENT_DYNAMIC' 在标识符_IMPLEMENT_DYNAMIC前少了一个分号。看看有没有漏包什么头文件。

注意看错误信息!