编译DLL时"error LNK2005: _DllMain@12 already defined"错误

编译出现如下错误


nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in QQInfo.obj
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in QQInfo.obj; second definition ignored
   Creating library Debug/QQInfo.lib and object Debug/QQInfo.exp
Debug/QQInfo.dll : fatal error LNK1169: one or more multiply defined symbols found


解决方法:

project setting->C/C++, 在category中选择Preprocessor,将preprocessor definitions中的_USRDLL删除即可。

 


网上查找过程中,MSDN也有一些应对资料


A LNK2005 error occurs when the CRT library and MFC libraries are linked in the wrong order in Visual C++

 

几种解决方案内容如下:

There are two ways to resolve this problem. The first solution involves forcing the linker to link the libraries in the correct order. The second solution allows you to find the module that is causing the problem and to correct it.

Note The following steps are based on Visual C++ 6.0.

Solution One: Force Linker to Link Libraries in Correct Order

To view the current library link order, follow these steps:

  1. On the Projectmenu, click Settings.
  2. In the Settings For view of theProject Settings dialog box, click to select the projectconfiguration that is getting the link errors.
  3. On the Link tab, type/verbose:lib in theProject Optionsbox.
  4. Rebuild your project. The libraries will be listed in theoutput window during the linking process.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值