链接错误在未修改的Visual Studio 2012 MFC模板静态链接MFC时 [英] Link Errors in Unmodified Visual Studio 2012 MFC Template when Statically Linking MFC
本文介绍了链接错误在未修改的Visual Studio 2012 MFC模板静态链接MFC时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在创建最简单的一种在Visual Studio 2012的一个新的MFC应用程序,将其设置为静态链接到MFC,连接失败。
When creating a new MFC application of the simplest kind in Visual Studio 2012, and setting it to link statically to MFC, linking fails.
这里是一个 通过向导从创建工程开始,到大楼(导致连接器的截屏7 画廊错误)。
未在中间进行源代码编辑。
错误日志状态:
1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1> stdafx.cpp
1> TestDlg.cpp
1> Test.cpp
1> Generating Code...
1>uafxcwd.lib(afxctrlcontainer2.obj) : error LNK2005: "void __cdecl AfxRegisterMFCCtrlClasses(void)" (?AfxRegisterMFCCtrlClasses@@YAXXZ) already defined in afxnmcdd.lib(afxctrlcontainer2.obj)
1>uafxcwd.lib(afxctrlcontainer2.obj) : error LNK2005: "protected: void __thiscall CMFCControlContainer::PreUnsubclassControl(class CWnd *)" (?PreUnsubclassControl@CMFCControlContainer@@IAEXPAVCWnd@@@Z) already defined in afxnmcdd.lib(afxctrlcontainer2.obj)
1>uafxcwd.lib(afxctrlcontainer2.obj) : error LNK2005: "public: int __thiscall CMFCControlContainer::SubclassDlgControls(void)" (?SubclassDlgControls@CMFCControlContainer@@QAEHXZ) already defined in afxnmcdd.lib(afxctrlcontainer2.obj)
1>C:\Users\XXXXXXXX\Documents\Visual Studio 2012\Projects\Test\Debug\Test.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
这只是我吗?请问您对如何解决这个问题?
Is this just me? Would you have a suggestion on how to address this?
推荐答案
我得到了同样的问题,当我尝试静态链接我的项目在一起。
I got the same problem when I try static link my project together.
正如迈克尔·伯尔认为,这似乎罚款注释掉后stdafx.h中的#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS行。
As Michael Burr suggested, it seems fine after commented out the line of #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS in stdafx.h.
这篇关于链接错误在未修改的Visual Studio 2012 MFC模板静态链接MFC时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文