我正在使用 Visual C++ 6,我的应用程序在调试模式下构建和运行良好,但是在尝试在发布模式下构建时出现以下两个未解决的外部符号错误:
OverUnderReportDoc.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall COverUnderReportDoc::GenerateReport(void)" (? GenerateReport@COverUnderReportDoc@@UAEHXZ)
OverUnderReportDoc.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall COverUnderReportDoc::DoReport(void)" (?DoReport@COverUnderReportDoc@@UAE_NXZ)
COverUnderReportDoc 是从 CReportDoc 派生的一个类,它是从 CDocument 派生的,它是 MFC 框架的一部分。
以下是函数声明:
public:
virtual int GenerateReport(void);
virtual bool DoReport(void);
以及定义:
bool COverUnderReportDoc::DoReport(void)
{
// Instantiate the dialog
CCriteriaDlg dlg;
m_Report.BreakSpace(FALSE);
// Get a pointer to the window
CWnd* pWnd = AfxGetApp()->m_pMainWnd;
// When OK is clicked...
if (dlg.DoModal() == IDOK)
{
// Set the document title
SetTitle("Inventory Over/Under");
// Copy some values from the dialog to member variables
GenerateReport();
pWnd->ShowWindow(SW_MAXIMIZE);
}
else
{
// If Cancel is clicked, close the program
if(pWnd)
pWnd->PostMessage(WM_CLOSE);
return false;
}
return true;
}
int COverUnderReportDoc::GenerateReport(void)
{
// write the headers to the report
// if there was no problem
if (DoHeaders())
{
// assemble the report data
// if that went well
if (ScanFile())
// write the summary to the report
DoSummary();
}
// return the document status
return m_nStatus;
}
我真的不确定如何解决这个问题,这些方法不在任何库中,并且该类编译得很好,所以我不知道为什么它在链接时看不到它们。有人有想法么?
编辑:这是我的项目选项:
发布项目选项:
(C/C++
标签Project Settings
)
/nologo /Zp1 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BTI_WIN_32" /FR"Release/" /Fo"Release/" /Fd"Release/" /FD /c
(Link
标签Project Settings
)
MYLIB.lib w3btrv7.lib VERSION.LIB /nologo /subsystem:windows /incremental:no /pdb:"Release/OverUnderReport.pdb" /machine:I386 /out:"Release/OverUnderReport.exe"
调试项目选项:
(C/C++
标签Project Settings
)
/nologo /Zp1 /MDd /W3 /GX /ZI /Ot /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BTI_WIN_32" /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
(Link
标签Project Settings
)
VERSION.LIB MYLIB.lib w3btrv7.lib /nologo /subsystem:windows /profile /debug /machine:I386 /out:"Debug/OverUnderReport.exe"