开发者

VS2010 Linker Error in MFC Dialog Based Project

开发者 https://www.devze.com 2023-02-02 16:00 出处:网络
I recently installed VS2010 Ultimate.I\'m trying to create a MFC dialog based program.I use the built in template, take all the default options, and then compile the project.I then get the following l

I recently installed VS2010 Ultimate. I'm trying to create a MFC dialog based program. I use the built in template, take all the default options, and then compile the project. I then get the following link errors.

1>------ Build started: Project: test1, Configuration: Debug Win32 ------
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall CWinApp::GetProfileIntW(wchar_t const *,wchar_t const *,int)" (?GetProfileIntW@CWinApp@@UAEIPB_W0H@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::WriteProfileInt(wchar_t const *,wchar_t const *,int)" (?WriteProfileInt@CWinApp@@UAEHPB_W0H@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CWinApp::GetProfileStringW(wchar_t const *,wchar_t const *,wchar_t const *)" (?GetProfileStringW@CWinApp@@UAE?AV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@PB_W00@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::WriteProfileStringW(wchar_t const *,wchar_t const *,wchar_t const *)" (?WriteProfileStringW@CWinApp@@UAEHPB_W00@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::GetProfileBinary(wchar_t const *,wchar_t const *,unsigned char * *,unsigned int *)" (?GetProfileBinary@CWinApp@@UAEHPB_W0PAPAEPAI@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::WriteProfileBinary(wchar_t const *,wchar_t const *,unsigned char *,unsigned int)" (?WriteProfileBinary@CWinApp@@UAEHPB_W0PAEI@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual class CDocument * __thiscall CWinApp::OpenDocumentFile(wchar_t const *,int)" (?OpenDocumentFile@CWinApp@@UAEPAVCDocument@@PB_WH@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CWinApp::RegisterWithRestartManager(wchar_t const *,unsigned long,unsigned long (__stdcall*)(void *),void *,unsigned long,unsigned long)" (?RegisterWithRestartManager@CWinApp@@UAEJPB_WKP6GKPAX@Z1KK@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CWinApp::RegisterWithRestartManager(int,class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)" (?RegisterWithRestartManager@CWinApp@@UAEJHABV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CWinApp::ApplicationRecoveryCallback(void *)" (?ApplicationRecoveryCallback@CWinApp@@UAEKPAX@Z)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual class CDataRecoveryHandler * __thiscall CWinApp::GetDataRecoveryHandler(void)" (?GetDataRecoveryHandler@CWinApp@@UAEPAVCDataRecoveryHandler@@XZ)
1>test开发者_StackOverflow1.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::IsTaskbarInteractionEnabled(void)" (?IsTaskbarInteractionEnabled@CWinApp@@UAEHXZ)
1>test1.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::RestartInstance(void)" (?RestartInstance@CWinApp@@UAEHXZ)
1>test1.obj : error LNK2019: unresolved external symbol "public: __thiscall CShellManager::CShellManager(void)" (??0CShellManager@@QAE@XZ) referenced in function "public: virtual int __thiscall Ctest1App::InitInstance(void)" (?InitInstance@Ctest1App@@UAEHXZ)
1>test1.obj : error LNK2019: unresolved external symbol "protected: virtual __thiscall CDialogImpl::~CDialogImpl(void)" (??1CDialogImpl@@MAE@XZ) referenced in function "public: virtual __thiscall CDialogEx::~CDialogEx(void)" (??1CDialogEx@@UAE@XZ)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual __thiscall CDialogImpl::~CDialogImpl(void)" (??1CDialogImpl@@MAE@XZ)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const * __stdcall CDialogEx::GetThisMessageMap(void)" (?GetThisMessageMap@CDialogEx@@KGPBUAFX_MSGMAP@@XZ)
1>test1Dlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CDialogEx::CDialogEx(unsigned int,class CWnd *)" (??0CDialogEx@@QAE@IPAVCWnd@@@Z) referenced in function "public: __thiscall CAboutDlg::CAboutDlg(void)" (??0CAboutDlg@@QAE@XZ)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CDialogEx::GetRuntimeClass(void)const " (?GetRuntimeClass@CDialogEx@@UBEPAUCRuntimeClass@@XZ)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "public: virtual class CMenu * __thiscall CWnd::GetMenu(void)const " (?GetMenu@CWnd@@UBEPAVCMenu@@XZ)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::SetMenu(class CMenu *)" (?SetMenu@CWnd@@UAEHPAVCMenu@@@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CWnd::OnDrawIconicThumbnailOrLivePreview(class CDC &,class CRect,class CSize,int,int &)" (?OnDrawIconicThumbnailOrLivePreview@CWnd@@UAEXAAVCDC@@VCRect@@VCSize@@HAAH@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CDialogEx::OnCommand(unsigned int,long)" (?OnCommand@CDialogEx@@MAEHIJ@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CDialogEx::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CDialogEx@@UAEHPAUtagMSG@@@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnTouchInputs(unsigned int,struct tagTOUCHINPUT *)" (?OnTouchInputs@CWnd@@MAEHIPAUtagTOUCHINPUT@@@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnTouchInput(class CPoint,int,int,struct tagTOUCHINPUT *)" (?OnTouchInput@CWnd@@MAEHVCPoint@@HHPAUtagTOUCHINPUT@@@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual unsigned long __thiscall CWnd::GetGestureStatus(class CPoint)" (?GetGestureStatus@CWnd@@MAEKVCPoint@@@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnGestureZoom(class CPoint,long)" (?OnGestureZoom@CWnd@@MAEHVCPoint@@J@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnGesturePan(class CPoint,class CPoint)" (?OnGesturePan@CWnd@@MAEHVCPoint@@0@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnGestureRotate(class CPoint,double)" (?OnGestureRotate@CWnd@@MAEHVCPoint@@N@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnGestureTwoFingerTap(class CPoint)" (?OnGestureTwoFingerTap@CWnd@@MAEHVCPoint@@@Z)
1>test1Dlg.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnGesturePressAndTap(class CPoint,long)" (?OnGesturePressAndTap@CWnd@@MAEHVCPoint@@J@Z)
1>test1Dlg.obj : error LNK2019: unresolved external symbol "public: long __thiscall CWnd::SendMessageW(unsigned int,unsigned int,long)const " (?SendMessageW@CWnd@@QBEJIIJ@Z) referenced in function "protected: void __thiscall Ctest1Dlg::OnPaint(void)" (?OnPaint@Ctest1Dlg@@IAEXXZ)
1>c:\Projects\test1\Debug\test1.exe : fatal error LNK1120: 32 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I've tried reinstalling VS2010 and made sure I had C++ installed, but I still get the errors. I've tried making the Multiple document and Single document types, these both work. So it's only the Dialog based one that has errors.

Thanks, John.


You have to link with MFC. Go to Project - > Project Property -> Configuration Properties -> In "Use of MFC" put "Use MFC in a Static Library"

0

精彩评论

暂无评论...
验证码 换一张
取 消