error LNK2005: DDX_Control 已经在 uafxcwd.lib(wincore2.obj) 中定义

error LNK2005: DDX_Control 已经在 uafxcwd.lib(wincore2.obj) 中定义

 

编译错误提示:

  

  1.  
    1>afxnmcdd.lib(wincore2.obj) : error LNK2005: "void __stdcall DDX_Control(classCDataExchange *,int,class CWnd &)" (?DDX_Control@@YGXPAVCDataExchange@@HAAVCWnd@@@Z)already defined in nafxcwd.lib(wincore2.obj)
  2.  
    1>afxnmcdd.lib(wincore2.obj) : error LNK2005: "public: int __thiscallCWnd::ExecuteDlgInit(void *)" (?ExecuteDlgInit@CWnd@@QAEHPAX@Z) already defined innafxcwd.lib(wincore2.obj)
  3.  
    1>afxnmcdd.lib(afxctrlcontainer2.obj) : error LNK2005: "void __cdeclAfxRegisterMFCCtrlClasses(void)" (?AfxRegisterMFCCtrlClasses@@YAXXZ) already definedin nafxcwd.lib(afxctrlcontainer2.obj)
  4.  
    1>afxnmcdd.lib(afxctrlcontainer2.obj) : error LNK2005: "protected: void __thiscallCMFCControlContainer::PreUnsubclassControl(class CWnd *)" (?PreUnsubclassControl@CMFCControlContainer@@IAEXPAVCWnd@@@Z) already defined innafxcwd.lib(afxctrlcontainer2.obj)
  5.  
    1>afxnmcdd.lib(afxctrlcontainer2.obj) : error LNK2005: "public: int __thiscallCMFCControlContainer::SubclassDlgControls(void)" (?SubclassDlgControls@CMFCControlContainer@@QAEHXZ) already defined innafxcwd.lib(afxctrlcontainer2.obj)
  6.  
    1>afxnmcdd.lib(afxctrlcontainer2.obj) : error LNK2005: "public: static int __stdcallCMFCControlContainer::UTF8ToString(char const *,class ATL::CStringT<char,classStrTraitMFC<char,class ATL::ChTraitsCRT<char> > > &,int)" (?UTF8ToString@CMFCControlContainer@@SGHPBDAAV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@H@Z) already defined in nafxcwd.lib(afxctrlcontainer2.obj)
  7.  
    1>.\Debug\application-ui.exe : fatal error LNK1169: one or more multiply definedsymbols found

    

原因分析:

  1、MFC工程引用了其它WIN32静态库

  2、WIN32静态库选择支持MFC。

解决办法:

  1、把所有WIN32静态库的stdafx.h文件中的一句代码#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS删除。

转载于:https://blog.csdn.net/weixin_30475039/article/details/95447347

posted on 2021-05-10 23:28  okgogo2000  阅读(109)  评论(0编辑  收藏  举报