nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined问题解决

来源:互联网 发布:气动打标机软件 编辑:程序博客网 时间:2024/05/22 06:56

如果开始用了一个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,删除,就可以正确编译了

原创粉丝点击