我建立了个单文档MFC工程,自己添加了一个对话框资源和对话框类!
我在自己添加的对话框类内想添加CZView类的指针,
定义如下
public:
     CZView* m_pView;
结果编译出错!
头文件都包含了!
错误如下:Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
z.cpp
MainFrm.cpp
zDoc.cpp
zView.cpp
Dlg.cpp
f:\z\zview.h(21) : error C2143: syntax error : missing ';' before '*'
f:\z\zview.h(21) : error C2501: 'CZDoc' : missing storage-class or type specifiers
f:\z\zview.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers
Generating Code...
执行 cl.exe 时出错.z.exe - 1 error(s), 0 warning(s)
烦请各位指点!

解决方案 »

  1.   

    在zview.h中增加#include "ZDoc.h"就OK 了。
      

  2.   

    没有用,编译的错误是一样的!
    我之前就加过了
    Compiling...
    Dlg.cpp
    f:\z\zview.h(21) : error C2143: syntax error : missing ';' before '*'
    f:\z\zview.h(21) : error C2501: 'CZDoc' : missing storage-class or type specifiers
    f:\z\zview.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers
      

  3.   

    循环包含
    ZView.h文件中,在所有的include结束后加一行
    class CZDoc;
    或dlg头文件中加入
    class CZView; 声明