织梦CMS - 轻松建站从此开始!

罗索

当前位置: 主页>杂项技术>VC(MFC)>

Project error LNK2005: _DllMain@12 already defined in MSVCRT

落鹤生 发布于 2014-01-25 22:01 点击:次 
這兩天在編譯公司軟件的一個舊版本的代碼。有一個工程在link時一直報告mfcs90ud.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj),編譯不過
TAG: MFC  链接错误  编译错误  

转自:
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
(秩名)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201401/16888.html]
本文出处:MSDN 作者:秩名
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容