按release版rebuild,错误提示如下:
Compiling...
GridCtrl.cpp
Linking...
LeftTreeView.obj : error LNK2001: unresolved external symbol "public: class CRptCfgDoc * __thiscall CLeftTreeView::GetDocument(void)" (?GetDocument@CLeftTreeView@@QAEPAVCRptCfgDoc@@XZ)
Release/RptCfg.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.debug版的话可以rebuild,并且能够运行。诚心请教各位高人,是什么原因,谢谢了!!!

解决方案 »

  1.   

    在CLeftTreeView类前加
    class CRptCfgDoc;
      

  2.   

    to ouyh12345:
    我加过了,如下:
    class CRptCfgView;
    class CSheetView;
    class CRptCfgDoc;
    class CLeftTreeView : public CTreeView
    {
    protected:
    CLeftTreeView();           // protected constructor used by dynamic creation
    DECLARE_DYNCREATE(CLeftTreeView)// Attributes
    public:
    CRptCfgDoc* GetDocument();
    // Operations
    public:
    void OnRefreshTree(int nType,CString strName);
    CImageList *pImage;
    CRptCfgView *m_pRptCfgView;
    HTREEITEM hTreeItem[5];

    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CLeftTreeView)
    public:
    virtual void OnInitialUpdate();
    protected:
    virtual void OnDraw(CDC* pDC);      // overridden to draw this view
    //}}AFX_VIRTUAL// Implementation
    public:
    void DeleteTreeItem();
    virtual ~CLeftTreeView();
    #ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
    #endif // Generated message map functions
    protected:
    //{{AFX_MSG(CLeftTreeView)
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnCloseSheet();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };
      

  3.   

    错误的意思是GetDocument函数没有实现
      

  4.   

    谢谢ouyh12345,问题已经解决了,果然如你所说。
    还有个问题,就是这个程序我在win2000和win xp都可以运行,但是在win2003上运行不起来,报的错误是:
    Unhandled exception in Rptcfg.exe (MSVCRTD.DLL):0XC0000005:Access Violation.
      

  5.   

    跟踪一下
    Access Violation
    越界访问,指针没初始话就使用、野指针等等
      

  6.   

    非常感谢 五岭散人 的指教,有些不明
    既然指针没初始话就使用、野指针等,为什么在win2000和xp下可以使用呢?
    出现错误的地方是:
       CMainFrame* pMainFrame = new CMainFrame;
       if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
    return FALSE;
    当我在if语句这一块设个断点,按F11往下执行,最后到了CreatEx函数这里出现了错误,
    请问什么原因?
      

  7.   

    不太清楚,没用过2003
    把CreatEx函数贴出来,并看看里面的参数
      

  8.   

    这是一个API函数,出错的地方在VC98\MFC\SRC\WINFRM.CPP中
                     if (!CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle,
    rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
    pParentWnd->GetSafeHwnd(), hMenu, (LPVOID)pContext))
            {
       TRACE0("Warning: failed to create CFrameWnd.\n");
       if (hMenu != NULL)
    DestroyMenu(hMenu);
       return FALSE;
            }
    在if这里设个断点,再往下执行就会出错了
      

  9.   

    如果是vc6。0的话你装一下sp6补丁解决这个问题。。
      

  10.   

    我用的就是VC6.0+sp5,哪里有sp6的补丁下呢?