我用了如下的方法实现。1)包含头文件 #include "MyView.h" 
2)在Frame类中,CMyView * m_pView = (CMyView*)this->GetActiveView();
然后访问其中类CMyView中的公共变量就会出错.错误信息如下:
1) myview.h(21) : error C2143: syntax error : missing ';' before '*'
2) myview.h(21) : error C2501: 'CQQDoc' : missing storage-class or type   specifiers
3) myview.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers

解决方案 »

  1.   

    加上这句
    class MyView;
    把#include "myview.h"去掉
      

  2.   

    既然是myview.h中的代码出错,你你还是检查一下myview.h吧。
    从现象上来看,很可能你的myview.h中需要QQDoc.h头文件。
      

  3.   

    多文档这样返回的一定是空!!试试:CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetApp()->m_pMainWnd;
       // Get the active MDI child window.
       CMDIChildWnd *pChild =
                      (CMDIChildWnd *) pFrame->GetActiveFrame();
       /* or CMDIChildWnd *pChild =
                      pFrame->MDIGetActive();
       */ 
       // Get the active view attached to the active MDI child window.
       CMyView *pView = (CMyView *) pChild->GetActiveView();
      

  4.   

    View.h之前包含doc.hCommand what is yours
    Conquer what is not
      

  5.   

    --楼上的老兄给的提示试过了,还是不行。
    如何从Frame类中访问View类中的变量(基于单文档)?
    ---你们一般是怎么实现的?
      

  6.   

    在Frame.cpp里面包含View.h之前包含doc.h
    任何时候,声明指针的时候都不需要包含定义,使用指针志向的对象的时候才需要包含定义
    头文件:
    class A;
    A* p;
    实现文件
    #include "a.h"
    p->func();
      

  7.   

    出现这样的问题,只要在View.h即类声明之前加上ViewDoc.h就可以了