在一个类中定义另一个对象时出现的有关问题
在一个类中定义另一个对象时出现的问题
在VC6.0中,在一个基类为 "EDITVIEW "的单文档MFC应用程序中,为何在CMainFrame类的MainFrm.cpp的开头加入 #include "XXXView.h ",即视类的头文件后,一编译就有如下错误:
f:\code\1\1view.h(21) : error C2143: syntax error : missing '; ' before '* '
f:\code\1\1view.h(21) : error C2501: 'CMy1Doc ' : missing storage-class or type specifiers
f:\code\1\1view.h(21) : error C2501: 'GetDocument ' : missing storage-class or type specifiers
------解决方案--------------------
在你的CXXXView定义前加一个前置声明
class CMy1Doc; //前置声明
class CXXXView : public
{.....
------解决方案--------------------
请注意:由于在VIEW类里有DOCUMENT类的调用,所以请把#include "xxxDoc.h "加在 "xxxView.h "前面!满意就送分啦~~
在VC6.0中,在一个基类为 "EDITVIEW "的单文档MFC应用程序中,为何在CMainFrame类的MainFrm.cpp的开头加入 #include "XXXView.h ",即视类的头文件后,一编译就有如下错误:
f:\code\1\1view.h(21) : error C2143: syntax error : missing '; ' before '* '
f:\code\1\1view.h(21) : error C2501: 'CMy1Doc ' : missing storage-class or type specifiers
f:\code\1\1view.h(21) : error C2501: 'GetDocument ' : missing storage-class or type specifiers
------解决方案--------------------
在你的CXXXView定义前加一个前置声明
class CMy1Doc; //前置声明
class CXXXView : public
{.....
------解决方案--------------------
请注意:由于在VIEW类里有DOCUMENT类的调用,所以请把#include "xxxDoc.h "加在 "xxxView.h "前面!满意就送分啦~~