Project error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj)

转自:
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/0b154e1c-141f-4567-bb24-1ac7c8ee2713/

When upgrading a DLL from VC6->VS2005, and you get the following:
mfcs80d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined
As suggested in the above comment, try the recommendation in the following link:

http://support.microsoft.com/default.aspx?scid=kb;en-us;q148652

if the suggestions in the above link fail, try the following:
In VS2005, select Project->Properties->Configuration Properties->Linker->Advanced
Set EntryPoint to DllMain
Save, clean & recompile.

另外,
转自 http://www.cppblog.com/NWAO/archive/2012/03/08/167403.aspx
問題:這兩天在編譯公司軟件的一個舊版本的代碼。有一個工程在link時一直報告mfcs90ud.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj),編譯不過
解決:排除工程設置等原因後,上網查找lnk2005資料,找到了解決辦法。
Step1 : Open project property--->Configuration property--->link-->Genral-->show Process 選為 VERBOSE:LIB,然後Build會看到如下內容:

1 1>Linking
2 1>Searching libraries
3 1>    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\MSVCRTD.lib:
4 1>    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\lib\mfcs90ud.lib:
5 1>mfcs90ud.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)

     據說是msvcrt和mfcs90u鏈接順序不對導致的,但為什麼順序會不正確,未能找到原因,解決辦法為為其強制指定順序,
Step2: project property--->Configuration property--->link-->Additional Dependies  = mfcs90ud.lib MSVCRTD.lib (DLL名字Debug版帶最後的D,Release版不帶,下同)
                                                                                    -->Ignore Specific Library = MSVCRTD.lib mfcs90ud.lib
     再編譯即OK
參考http://support.microsoft.com/kb/148652

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值