uafxcwd.lib(dllmodul.obj) : error LNK2005: DllMain 已经在 中定义

如果出现这种错误:“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

 

 

http://hi.baidu.com/laosuis/blog/item/6a881d3ccacbfbe93d6d97bc.html

你可能感兴趣的:(多线程,File,Module,ide,dll,preprocessor)