我按照网上帖出来的代码(我在好多帖子中都看到这样的代码)
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
// TODO: Add your specialized code here and/or call the base class
if(wndSplitter1.CreateStatic(this,3,1)==NULL)
return FALSE;
wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CCutFTPView),CSize(100,100), 
                                  pContext); 
wndSplitter1.CreateView(2,0,RUNTIME_CLASS(CView4),CSize(100,100),pContext);
if(wndSplitter2.CreateStatic
            (&wndSplitter1,1,2,WS_CHILD|WS_VISIBLE,wndSplitter1.IdFromRowCol(1, 0))
             ==NULL) 
        return FALSE;
wndSplitter2.CreateView(0,1,RUNTIME_CLASS(CView3),CSize(400,300),pContext); wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CView2),CSize(400,300),pContext);

return CFrameWnd::OnCreateClient(lpcs, pContext);
}其中:
   CSplitterWnd wndSplitter1;
   CSplitterWnd wndSplitter2;
   CView2,3,4从CView继承。
   CCutFTPView是系统自动创建的视图类。运行后报错:
error C2653: 'CCutFTPView' : is not a class or namespace name
error C2065: 'classCCutFTPView' : undeclared identifier我在MainFrame.cpp中添加  #include "CutFTPView.h"
就会报错:
error C2143: syntax error : missing ';' before '*'
rror C2501: 'CCutFTPDoc' : missing storage-class or type specifiers
error C2501: 'GetDocument' : missing storage-class or type specifiers请问是什么原因?如何解决?我想,好多论坛里都帖出这样的代码,应该就是没有问题的了,可是我却遇到了问题。希望各位高手帮小弟解决。谢谢了。
       

解决方案 »

  1.   

    在"CutFTPView.h"
    里加个
    class CCutFTPDoc;
      

  2.   

    像你说的,我在CutFTPView.h中加了class CCutFTPDoc;后,出现了新的问题,原来没有的:
    MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CView2::classCView2" (?classCView2@CView2@@2UCRuntimeClass@@B)
    MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CView3::classCView3" (?classCView3@CView3@@2UCRuntimeClass@@B)
    MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CView4::classCView4" (?classCView4@CView4@@2UCRuntimeClass@@B)
    Debug/CutFTP.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.