包含了afxcmn.h为什么还是说小弟我error C2065: 'InsertItem' : undeclared identifier

包含了afxcmn.h为什么还是说我error C2065: InsertItem : undeclared identifierBOOL CCoolTabCtrl::Add

包含了afxcmn.h为什么还是说我error C2065: 'InsertItem' : undeclared identifier
BOOL CCoolTabCtrl::AddPage(LPTSTR lpszLabel, CRuntimeClass *pViewClass, CCreateContext *pContext)
{


#ifdef _DEBUG
ASSERT_VALID(this);
ASSERT(pViewClass != NULL);
ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
#endif

CCreateContext context;
if (pContext == NULL)
{
// *** LiangYiBin.Donald
context.m_pCurrentDoc = NULL;
context.m_pCurrentFrame = GetParentFrame();
context.m_pLastView = NULL;
context.m_pNewDocTemplate = NULL;
context.m_pNewViewClass = pViewClass;
pContext = &context;
}

CWnd* pWnd;
TRY
{
pWnd = (CWnd*)pViewClass->CreateObject();
if (pWnd == NULL)
AfxThrowMemoryException();
}
CATCH_ALL(e)
{
TRACE0(_T("Out of memory creating a view.\n"));
// Note: DELETE_EXCEPTION(e) not required
return FALSE;
}
END_CATCH_ALL

ASSERT_KINDOF(CWnd, pWnd);
ASSERT(pWnd->m_hWnd == NULL); // not yet created

DWORD dwStyle = AFX_WS_DEFAULT_VIEW;
// RECT rcView;
  //m_rcView.bottom = m_rcView.top = m_rcView.left = m_rcView.right = 0;

// Create with the right size and position
if (!pWnd->Create(NULL, NULL, dwStyle, m_rcView, this, 0, pContext))
{
TRACE0(_T("Warning: couldn't create client pane for view.\n"));
// pWnd will be cleaned up by PostNcDestroy
return FALSE;
}
CView* pView = (CView*) pWnd;

TC_ITEM ti;
ti.mask=TCIF_TEXT;

ti.pszText= lpszLabel;
InsertItem(m_arrView.GetSize(),&ti);
m_arrView.Add(pView);

SetActivePage(m_arrView.GetSize()-1);
return TRUE;
}
这个文件最开始包含了afxcmn.h,里面定义了BOOL InsertItem(int nItem, TCITEM* pTabCtrlItem);为什么还是会出错,说InsertItem没有定义呢?

[解决办法]
InsertItem是CTreeCtrl类的成员函数,需要CTreeCtrl的对象或者指针来调用的。
按照你现在这样的写法编译器会认为InsertItem是CCoolTabCtrl的成员函数