MFC中的一个错误

如果在文档类中,直接调用CView类,编译器可能会产生这样的错误:

f:\项目工程\vs\hbcompile\hbcompile\hbcompileview.h(16): error C2143: syntax error : missing ';' before '*'
1>f:\项目工程\vs\hbcompile\hbcompile\hbcompileview.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\项目工程\vs\hbcompile\hbcompile\hbcompileview.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\项目工程\vs\hbcompile\hbcompile\hbcompileview.h(16): warning C4183: 'GetDocument': missing return type; assumed to be a member function returning 'int'

解决方法:

在CView类的头文件中,加入"class CXXDoc;"

posted @ 2013-09-02 19:42  Fly Hawk  阅读(240)  评论(0编辑  收藏  举报