我有一个奇怪的工程,插入其中的新类(以MFC类为父类),总是提示error C2504: 'CTreeView' : base class undefined,但工程中原来有的类用到MFC的就没有问题,不得其解,请教各位大侠.

解决方案 »

  1.   

    这是提示出错的文件:#if !defined(AFX_BROWSEVIEW_H__675BA56A_0B4B_42A5_89CD_0E56AA6A492A__INCLUDED_)
    #define AFX_BROWSEVIEW_H__675BA56A_0B4B_42A5_89CD_0E56AA6A492A__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // BrowseView.h : header file
    //
    /////////////////////////////////////////////////////////////////////////////
    // CBrowseView viewclass CBrowseView : public CTreeView
    {
    protected:
    CBrowseView();           // protected constructor used by dynamic creation
    DECLARE_DYNCREATE(CBrowseView)// Attributes
    public:// Operations
    public:// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CBrowseView)
    protected:
    virtual void OnDraw(CDC* pDC);      // overridden to draw this view
    //}}AFX_VIRTUAL// Implementation
    protected:
    virtual ~CBrowseView();
    #ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
    #endif // Generated message map functions
    protected:
    //{{AFX_MSG(CBrowseView)
    // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_BROWSEVIEW_H__675BA56A_0B4B_42A5_89CD_0E56AA6A492A__INCLUDED_)
      

  2.   

    在你的StdAfx.h中加上
    #include <afxcview.h>
    就可以了,用到CTreeView的时候需要这个头文件祝你成功!
      

  3.   

    包一个头文件
    #include <afxcview.h>
      

  4.   

    #include <afxcview.h>