关于分裂窗口
本人在创建MFC工程的时候,选择了不采用view-Document结构,因为有Document实在麻烦。而在采用分裂窗口的时候,代码如下:
CChildView.h添加:
DECLARE_DYNCREATE(CChildView)
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)里添加
if(!m_wndSplitter.CreateStatic (this,2,1))
return FALSE;
if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CChildView),CSize(800,400),pContext)||
!m_wndSplitter.CreateView (1,0,RUNTIME_CLASS(CChildView),CSize(800,100),pContext))
{m_wndSplitter.DestroyWindow();
return FALSE;
}
return TRUE;
编译时出现错误:
1>ChildView.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CChildView::GetRuntimeClass(void)const " (?GetRuntimeClass@CChildView@@UBEPAUCRuntimeClass@@XZ)
1>MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CChildView::classCChildView" (?classCChildView@CChildView@@2UCRuntimeClass@@B)
1>C:\Users\Administrator\Desktop\WirelessClass\Debug\WirelessClass.exe : fatal error LNK1120: 2 unresolved externals
不知何解?
[解决办法]
找不到CChildView::GetRuntimeClass这个函数的实现.