mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain 解决办法

作者在 2008-06-12 16:34:52 发布以下内容
链接错误 mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain 解决办法
2008-03-06 17:01

mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj); second definition ignored

做项目时,遇到这个问题,很诡异,因为开始编译链接都是OK的,可是关闭工程再重新build时出现了上面的错误,在网上找了很多方法,大多都是微软的那两个方案,但是我试了没用!!

还有一个网友的办法是:

使用lib命令,从mfcs42d.lib里面解出dllmodul.obj
这个文件加入到link的obj文件里面。

我机子上用lib解不出来,放弃。

最后在codeguru网站上找到了解决办法:

The fix is very simple, just do the following.

1)Select BUILD|SETTINGS
2)In the left hand pane highlight WIN32 Debug
3)Go to the LINK tab
4)Select the INPUT 'category'
5)in the edit box labeled "Ignore Libraries"
     type the following two libs
      MSVCRTD.lib, mfcs42d.lib   (order doesn't matter _here_)
6)Now in the edit box labeled "Object/Library Modules" type the following two libs
     mfcs42d.lib, MSVCRTD.lib
MAKE SURE THEY ARE IN THIS ORDER AND THEY ARE LISTED AS THE FIRST & SECOND LIBS IN THE EDIT BOX
7)rebuild and all should be fine. Basically what you did was tell the linker to skip the implied inclusion of these libs, and then manually told it to include them in the specific order mentioned

(编程)Work | 阅读 11956 次
文章评论,共0条
游客请输入验证码
浏览317323次