Я использую 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;
}
Я действительно не уверен, как это решить, этих методов нет ни в одной библиотеке, и класс компилируется нормально, поэтому я не знаю, почему он не видит их при компоновке. У кого-нибудь есть идеи?
EDIT: Вот варианты моего проекта:
Параметры выпуска проекта:
(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"
CReportDoc
?COverUnderReportDoc : public CReportDoc
- person Joe   schedule 07.01.2012COverUnderReportDoc
публично наследуется отCReportDoc
. Я также добавлю варианты своего проекта в исходный пост, так как я действительно не знаю, на что я смотрю с этими... - person NobodyNothing   schedule 07.01.2012.obj
существуют в каталогеDebug
, и сравните их с теми, которые существуют в каталогеRelease
. Существуют ли одинаковые файлы (они будут отличаться по размеру). - person hmjd   schedule 07.01.2012.obj
в папкеDebug
соответствует.obj
в папкеRelease
. - person NobodyNothing   schedule 07.01.2012bool COverUnderReportDoc::DoReport(void)
? - person hmjd   schedule 07.01.2012