banner.gif adie's blog
主页 博客 胭脂泪,相留醉,几时重,自是人生长恨水长东
统计
日志总数: 127
评论总数: 123
日志分类
日志归档
最近日志
最近评论
订阅
rss2.gif

atom.gif

google_rss
yc.gif 【技术资料】 阅读 85440 次

VC2015 缩减 MFC 静态链接生成 exe 文件的大小

2015-12-25 16:13:43

建工程的时候一定要选上 No enhanced MFC controls.

如果是从以前版本的工程升级到 2015 的,在 stdafx.h 头文件中加上:

#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS

 

如果建工程的时候没选 No enhanced MFC controls. 之后的修改方法为:

1. stdafx.h 中加上 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS

2. 在 工程名.rc 文件中去掉 #include "afxribbon.rc"   // MFC ribbon and control bar resources

▲评论

› 网友 adie () 于 2016-12-28 16:05:52 发表评论说:
链接时出现错误: >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 __cdecl CMFCControlContainer::PreUnsubclassControl(class CWnd *)" (?PreUnsubclassControl@CMFCControlContainer@@IEAAXPEAVCWnd@@@Z) already defined in afxnmcdd.lib(afxctrlcontainer2.obj) 1>uafxcwd.lib(afxctrlcontainer2.obj) : error LNK2005: "public: int __cdecl CMFCControlContainer::SubclassDlgControls(void)" (?SubclassDlgControls@CMFCControlContainer@@QEAAHXZ) already defined in afxnmcdd.lib(afxctrlcontainer2.obj) 1>E:\work\yproject\DbgTools\x64\Debug\MemoryWalker.exe : fatal error LNK1169: one or more multiply defined symbols found 还需要删除和工程同名的 cpp 文件中的 // Create the shell manager, in case the dialog contains // any shell tree view or shell list view controls. CShellManager *pShellManager = new CShellManager; // Activate "Windows Native" visual manager for enabling themes in MFC controls CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); 和 // Delete the shell manager created above. if (pShellManager != NULL) { delete pShellManager; }
X 正在回复:
姓 名: 留下更多信息
性 别:
邮 件:
主 页:
Q Q:
来 自:
职 业:
评 论:
验 证:


Valid HTML 4.01 Strict Valid CSS!
Copyleft.A!die Software Studio.ADSS
Power by webmaster@adintr.com