一个关于CSplitterWnd类的问题
我是一个vc新手,在具体编程过程中遇到以下问题,希望得到老手的指点,不胜感激。
首先,我建立了一个名为Test的mfc单文档程序。
Insert-〉class,添加两个CView派生的视图类CView1,CView2
然后在CMainFrm.h中添加了#include "View1.h"
#include "View2.h"
在CMainFrame中添加两个CSplitterWnd类,SP1和SP2
然后重掉虚函数OnCreateClient(),其代码如下:
if (SP1.CreateStatic(this,2,1)==NULL)
{TRACE0("Can't create the splitterwnd!/n");
return -1;}
SP1.CreateView(0,0,RUNTIME_CLASS(CTestView),CSize(600,0),pContext);
if (SP2.CreateStatic(&SP1,1,2,WS_CHILD|WS_VISIBLE,AFX_IDW_PANE_FIRST+1)==NULL)
{TRACE0("Can't create the splitterwnd!/n");
return -1;}
SP2.CreateView(0,0,RUNTIME_CLASS(CView1),CSize(300,400),pContext);
SP2.CreateView(0,1,RUNTIME_CLASS(CView2),CSize(300,400),pContext);
return 0;
很明显,是为了切分一个窗口为三个小窗口,但编译结果是这样的错误:
……\MainFrm.cpp(76) : error C2653: 'CTestView' : is not a class or namespace name
……\MainFrm.cpp(76) : error C2065: 'classCTestView' : undeclared identifier
请问各位大虾,这是为什么?如能回复,小弟先谢谢啦