uafxcwd.lib(dllmodul.obj) : error LNK2005: DllMain 已经在 中定义
2010-09-19 23:17
483 查看
如果出现这种错误:“uafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12
already defined in main.obj ”或者“mfcs42ud.lib(dllmodul.obj) : error
LNK2005: _DllMain@12 already defined in main.obj ”,那么“See if you have
_AFXDLL and _USRDLL in the preprocessor definitions. Try removing one of
them”。具体位置:IDE中 菜单Project / Setting / C/C++ / preprocessor definition 。
Project / Setting / C/C++ / 代码生成---->>运行时库---->>多线程调试 DLL
(/MDd)
资深员工说加入以下代码:
#include "stdafx.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
/////////////////////////////////////////////////////////////////////////////
// global data
// The following symbol used to force inclusion of this module for
_USRDLL
#ifdef _X86_
extern "C" { int _afxForceUSRDLL; }
#else
extern "C" { int __afxForceUSRDLL; }
#endif
另外,极有可能是加了#include <afx.h>
后记:
来此取经的有人说:
http://hi.baidu.com/ollyestn/blog/item/c9baf4df832042e676c638a8.html
今天编译又碰到这个DllMain已经在xxx中被定义的问题,搜了一下,情况还很多,不过主要还是预定义的问题,我的预
定义宏如下:
_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;
网上有人说是:“See if you have _AFXDLL and _USRDLL in the
preprocessor definitions. Try removing one of them”。但是我的定义里面只有一个 _USRDLL
而没有 _AFXDLL,但是在stdafx.h中代码中包括了包含了<afxwin.h>。
现在只要去掉_USRDLL ,再编译,OK。
简单的记下来,仅为下次碰到该问题时,不再迷惑。
----不知道是否真切
already defined in main.obj ”或者“mfcs42ud.lib(dllmodul.obj) : error
LNK2005: _DllMain@12 already defined in main.obj ”,那么“See if you have
_AFXDLL and _USRDLL in the preprocessor definitions. Try removing one of
them”。具体位置:IDE中 菜单Project / Setting / C/C++ / preprocessor definition 。
Project / Setting / C/C++ / 代码生成---->>运行时库---->>多线程调试 DLL
(/MDd)
资深员工说加入以下代码:
#include "stdafx.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
/////////////////////////////////////////////////////////////////////////////
// global data
// The following symbol used to force inclusion of this module for
_USRDLL
#ifdef _X86_
extern "C" { int _afxForceUSRDLL; }
#else
extern "C" { int __afxForceUSRDLL; }
#endif
另外,极有可能是加了#include <afx.h>
后记:
来此取经的有人说:
http://hi.baidu.com/ollyestn/blog/item/c9baf4df832042e676c638a8.html
今天编译又碰到这个DllMain已经在xxx中被定义的问题,搜了一下,情况还很多,不过主要还是预定义的问题,我的预
定义宏如下:
_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;
网上有人说是:“See if you have _AFXDLL and _USRDLL in the
preprocessor definitions. Try removing one of them”。但是我的定义里面只有一个 _USRDLL
而没有 _AFXDLL,但是在stdafx.h中代码中包括了包含了<afxwin.h>。
现在只要去掉_USRDLL ,再编译,OK。
简单的记下来,仅为下次碰到该问题时,不再迷惑。
----不知道是否真切
相关文章推荐
- uafxcwd.lib(dllmodul.obj) : error LNK2005: DllMain 已经在 中定义
- uafxcwd.lib(dllmodul.obj) : error LNK2005: DllMain 已经在 中定义
- uafxcwd.lib(dllmodul.obj) : error LNK2005: DllMain 已经在 中定义
- VC编译错误: Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12已经在dllmain.obj 中定义
- VC: Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 已经在dllmain.obj 中定义
- mfcs100ud.lib(dllmodul.obj) : error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义
- VC++编译错误: Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12已经在dllmain.obj 中定义
- VC编译错误: Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12已经在dllmain.obj 中定义
- "nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12..."错误!
- LIBCMT.lib(vswprnc.obj) : error LNK2005: 已经在 msvcrtd.lib(MSVCR100D.dll) 中定义
- 遇到此类问题:error LNK2005: _DllMain@12 已经在 MSVCRT.lib(dllmain.obj) 中定义
- uafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in main.obj
- 【VS开发】uafxcwd.lib(afxmem.obj) : error LNK2005: 已经在 LIBCMTD.lib(new.obj) 中定义错误解决方案
- mfcs100d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)
- error LNK2005: _DllMain@12 已经在 LIBCMTD.lib(dllmain.obj) 中定义
- mfcs100d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)
- uafxcwd.lib(afxmem.obj) : error LNK2005: 已经在 LIBCMTD.lib(new.obj) 中定义错误解决方案
- error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义
- mfcs100d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)
- 封装dll遇到的奇葩错误:error LNK2005: _DllMain@12 已经在 DLLMain.obj 中定义