按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,并且能够运行。诚心请教各位高人,是什么原因,谢谢了!!!
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,并且能够运行。诚心请教各位高人,是什么原因,谢谢了!!!
class CRptCfgDoc;
我加过了,如下:
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()
};
还有个问题,就是这个程序我在win2000和win xp都可以运行,但是在win2003上运行不起来,报的错误是:
Unhandled exception in Rptcfg.exe (MSVCRTD.DLL):0XC0000005:Access Violation.
Access Violation
越界访问,指针没初始话就使用、野指针等等
既然指针没初始话就使用、野指针等,为什么在win2000和xp下可以使用呢?
出现错误的地方是:
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
当我在if语句这一块设个断点,按F11往下执行,最后到了CreatEx函数这里出现了错误,
请问什么原因?
把CreatEx函数贴出来,并看看里面的参数
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这里设个断点,再往下执行就会出错了