错误LNK2005:已在LIBCMTD.lib(new.obj)中定义的新和删除 [英] error LNK2005: new and delete already defined in LIBCMTD.lib(new.obj)

查看:866
本文介绍了错误LNK2005:已在LIBCMTD.lib(new.obj)中定义的新和删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Visual studio 2005解决方案,有两个项目。一个是静态库,另一个是用于测试静态库中的功能的可执行文件。静态库使用MFC。我在构建解决方案时遇到以下错误。

I have a Visual studio 2005 solution that has two projects. One is a static library and the other is a executable used to test the features in the static library. The static library uses MFC. I got the following errors when I built the solution.

uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
uafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??    3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in libcpmtd.lib(newaop.obj)
uafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCMTD.lib(delete2.obj)

我不知道如何克服这个。可能有人请解释为什么会发生这个错误。将高度赞赏任何给出.lib文件链接的概述的解释。

I do not know how to overcome this. Can some one please explain why this error is occuring. Any explanation that gives an overview of .lib files linkage will be highly appreciated.

推荐答案

如果其他(非静态库)项目是一个CRT项目,请查看以下链接:

If the other (non static library) project is a CRT project, check out this link:

http://support.microsoft.com/kb/148652

这篇关于错误LNK2005:已在LIBCMTD.lib(new.obj)中定义的新和删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆