如果开始用了一个ATL的Dll工程,然后为了在这个dll工程里面使用MFC,
在里面加入MFC支持
在stdafx.h的atlbase.h前面加入
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation extensions
那么就会出现错误,例如
nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LyricPlayerdll.obj
nafxcw.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in LyricPlayerdll.obj; second definition ignored
???? Creating library Release/IWOBZ_Lyric_Plugin.lib and object Release/IWOBZ_Lyric_Plugin.exp
Release/IWOBZ_Lyric_Plugin.dll : fatal error LNK1169: one or more multiply defined symbols found
解决办法:
工程->设置->C/C++->
Category:Preprocessor
Preprocessor definitions:
WIN32,NDEBUG,_WINDOWS,_MBCS,_USRDLL,MSGBOX_EXPORTS,_WINDLL,_AFXDLL中的_USRDLL,删除,就可以正确编译了
nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined问题解决
最新推荐文章于 2022-04-07 13:52:14 发布
本文介绍如何解决在一个ATL DLL项目中引入MFC支持后遇到的编译错误,特别是关于_DllMain@12重复定义的问题,并提供了解决方案。

437

被折叠的 条评论
为什么被折叠?



