I am trying to a "File Save As" programming code inside MFC Application.
in my TestDlg.h header file i have got
public:
BOOL SaveFile (LPCTSTR pszFile);
CString m_strPathName;
And in my TestDlg.cpp CPP file I have got
void CTESTDlg::OnSaveFile()
{
TCHAR szFilters[] =
_T ("Text files (*.txt)¦*.txt¦All files (*.*)¦*.*¦¦");
CFileDialog dlg (FALSE, _T ("txt"), _T ("*.txt"),
OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY, szFilters);
if (dlg.DoModal () == IDOK)
{
if (SaveFile (dlg.GetPathName ()))
m_strPathName = dlg.GetPathName ();
}
}
After this, I build my solution and got this error.
LNK2019: unresolved external symbol "public: int __thiscall CTESTDlg::SaveFile(wchar_t const *)" (?SaveFile@CTESTDlg@@QAEHPB_W@Z) referenced in function "public:
How do I resolve this?? Help is much appreciated. Thank you.
EDIT.
After removing the if (SaveFile (dlg.GetPathName ()) line, the file can build and run but when ever I press the save button, no file is saved.
SaveFile? Are you compiling the cpp? - Luchian GrigoreBOOL SaveFile (LPCTSTR pszFile);- this is not implementation. - Alex F