Keep on going, never give up.

error LNK2005: void __stdcall DDX_Control...already defined in uafxcw.lib(wincore2.obj)

 在VS2013中使用静态库,提示错误如下:

1>afxnmcd.lib(wincore2.obj) : error LNK2005: "void __stdcall DDX_Control(class CDataExchange *,int,class CWnd &)" (?DDX_Control@@YGXPAVCDataExchange@@HAAVCWnd@@@Z) already defined in uafxcw.lib(wincore2.obj)
1>afxnmcd.lib(wincore2.obj) : error LNK2005: "public: int __thiscall CWnd::ExecuteDlgInit(void *)" (?ExecuteDlgInit@CWnd@@QAEHPAX@Z) already defined in uafxcw.lib(wincore2.obj)
1>afxnmcd.lib(afxctrlcontainer2.obj) : error LNK2005: "void __cdecl AfxRegisterMFCCtrlClasses(void)" (?AfxRegisterMFCCtrlClasses@@YAXXZ) already defined in uafxcw.lib(afxctrlcontainer2.obj)
1>afxnmcd.lib(afxctrlcontainer2.obj) : error LNK2005: "protected: void __thiscall CMFCControlContainer::PreUnsubclassControl(class CWnd *)" (?PreUnsubclassControl@CMFCControlContainer@@IAEXPAVCWnd@@@Z) already defined in uafxcw.lib(afxctrlcontainer2.obj)
1>afxnmcd.lib(afxctrlcontainer2.obj) : error LNK2005: "public: int __thiscall CMFCControlContainer::SubclassDlgControls(void)" (?SubclassDlgControls@CMFCControlContainer@@QAEHXZ) already defined in uafxcw.lib(afxctrlcontainer2.obj)
1>E:\Test\Release\test.exe : fatal error LNK1169: one or more multiply defined symbols found

解决办法:

把静态库工程中的stdafx.h文件中的:

#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS         // remove support for MFC controls in dialogs

一句话删除即可,因为在创建静态库时,选择了支持MFC。

相关评论(0):  

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

订阅博客

最新文章

本站采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载也必须遵循“署名-非商业用途-保持一致”的创作共用协议. 返回顶部
Copyright@2005-2016 Metsky.com, All rights Reserved.