本人建立了一个单文档程序,命名为分割窗口,自动生成了CMyView类。
我现在想建立一个1行2列的分割窗口。
将画图程序写到CMyView类中作为一个窗口,另一个窗口为控制台,为其添加的类为CControlWnd。
现在程序如下:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{ if(m_wndSplitter.CreateStatic(this,1,2)==NULL)
return FALSE; m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(500,150),pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CControlWnd),CSize(100,200),pContext);
return TRUE;
}
编译运行时就报错 (93) :error C2653: 'CMyView' : is not a class or namespace name
(93) : error C2065: 'classCMyView' : undeclared identifier
我在MainFrm.cpp中添加了头文件,还是报上面的错误!但是我换成一个新添加的从CView派生出来的类,比如CTree,
替换RUNTIME_CLASS(CMyView)为RUNTIME_CLASS(CTree)就能运行通过。请问各位仁兄这是为什么呢?困惑了好几天!找不到原因?
我现在想建立一个1行2列的分割窗口。
将画图程序写到CMyView类中作为一个窗口,另一个窗口为控制台,为其添加的类为CControlWnd。
现在程序如下:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{ if(m_wndSplitter.CreateStatic(this,1,2)==NULL)
return FALSE; m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(500,150),pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CControlWnd),CSize(100,200),pContext);
return TRUE;
}
编译运行时就报错 (93) :error C2653: 'CMyView' : is not a class or namespace name
(93) : error C2065: 'classCMyView' : undeclared identifier
我在MainFrm.cpp中添加了头文件,还是报上面的错误!但是我换成一个新添加的从CView派生出来的类,比如CTree,
替换RUNTIME_CLASS(CMyView)为RUNTIME_CLASS(CTree)就能运行通过。请问各位仁兄这是为什么呢?困惑了好几天!找不到原因?
view.h(21) : error C2501: 'CMyDoc' : missing storage-class or type specifiers
view.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers怎么回事呢?
再将CMyDoc的头文件加到 MainFrm.h中