MFC程序如何使用hashtable?
我工程类型是MFC(exe)类型的.
原文件如下:
// ContainerView.cpp : implementation of the CContainerView class
//
#include "stdafx.h"
#include "Container.h"
#include "ContainerDoc.h"
#include "ContainerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
using namespace System;
using namespace System::Collections;
/////////////////////////////////////////////////////////////////////////////
// CContainerView
IMPLEMENT_DYNCREATE(CContainerView, CView)
BEGIN_MESSAGE_MAP(CContainerView, CView)
//{{AFX_MSG_MAP(CContainerView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CContainerView construction/destruction
CContainerView::CContainerView()
{
// TODO: add construction code here
}
CContainerView::~CContainerView()
{
}
BOOL CContainerView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CContainerView drawing
void CContainerView::OnDraw(CDC* pDC)
{
CContainerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CContainerView printing
BOOL CContainerView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CContainerView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CContainerView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CContainerView diagnostics
#ifdef _DEBUG
void CContainerView::AssertValid() const
{
CView::AssertValid();
}
void CContainerView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CContainerDoc* CContainerView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CContainerDoc)));
return (CContainerDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CContainerView message handlers
然后报错:
D:\testcode\2007\12.06\Container\ContainerView.cpp(17) : error C2871: 'System' : does not exist or is not a namespace
D:\testcode\2007\12.06\Container\ContainerView.cpp(18) : error C2653: 'System' : is not a class or namespace name
D:\testcode\2007\12.06\Container\ContainerView.cpp(18) : error C2871: 'Collections' : does not exist or is not a namespace
这个应该如何处理呢?谢谢!