我在工程设置里设定MFC库使用动态连接,能够成功编译连接并运行,但使用静态连接,却有下面的连接错误:
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmtd.lib(delop.obj)
(delete操作符重定义?)
有谁知道是怎么回事吗?
另:
我有一个使用了CJ60Libd.lib的工程,Debug版本能够成功编译连接运行,但Release版本运行却有断言错(提示在afxwin1.inl)!在栈里能看到是第一次调用CJ60Libd库之后出现的。但那一堆汇编码让我不知所措。有哪位大侠可以告诉我下一部我该怎么做吗?——我总不能拿个Debug版去交差吧?
>_<

解决方案 »

  1.   

    看看这个处理的思路或许对你有用:
    FIX: Error Message: C2668: InlineIsEqualGUID : Ambiguous Call to Overloaded Function
    Q243298
     
    The information in this article applies to:
    &#8226; The Microsoft Active Template Library (ATL) 3.0, used with: 
    o Microsoft Visual C++, 32-bit Editions, version 6.0
     SYMPTOMS
    Building a default ATL project containing a COM object supporting ISupportErrorInfo might result in the following error:
    C2668: 'InlineIsEqualGUID' : ambiguous call to overloaded function 
    This error may also occur when calling the function InlineIsEqualGUID() in your ATL project. CAUSE
    The problem occurs because the function InlineIsEqualGUID() is defined both in the ATL header file, AtlBase.h, and the Platform SDK header file, Guiddef.h, in different name spaces. The include paths for the build point first to the Platform SDK include directory, and then to the ATL include directory. In the ATL header, InlineIsEqualGUID() is defined in a name space called "ATL", while in the Platform SDK header it is defined in the global name space. Because AtlBase.h includes the statement using namespace ATL; 
    the compiler is unable to distinguish which definition to use. RESOLUTION
    There are three ways to work around this problem: 
    &#8226; Prefix the call to the InlineIsEqualGUID() function with either :: or ATL::. This explicitly indicates whether you want to use the ATL or Platform SDK definition. For example: 
    &#8226;
    &#8226; ::InlineIsEqualGUID() 
    ATL::InlineIsEqualGUID() &#8226; Change the order of the include directories on the Directory tab of the Options dialog box, which is accessed from the Tools menu, so that the ATL include directory is before the Platform SDK include directory. 
    &#8226; In the StdAfx.h file of your ATL project, change the path of AtlBase.h to point to the AtlBase.h file in the ATL30 directory under the Platform SDK include directory. STATUS
    Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.This problem was corrected in the Microsoft Platform SDK January 2000 Edition.MORE INFORMATION
    Steps to Reproduce Behavior
    1. Create an ATL DLL project and insert a simple object into the project with ISupportErrorInfo support.
    2. Make sure that the includes path for the Platform SDK include directory comes before the ATL include directory on the Directory tab of the Options dialog box, which is accessed from the Tools menu.
    3. Build the project, and the error message appears.
    Additional query words: PlatSDK MMC Samples ATL Object Wizard 
    Keywords : kbCOMt kbDebug kbSDKPlatform kbSDKWin32 kbVC600bug kbATL300bug kbDSupport kbfix kbGrpMFCATL 
    Issue type : kbbug 
    Technology : kbvc 
      

  2.   

    你是不是用了第三方的库?可能其中定义了全局的operator delete,而MFC也定义了全局的operator delete,这样在静态连接时就会出现重复定义错误。
      

  3.   

    to flyelf(空谷清音):
    rebuild all几十次了to oyljerry(☆勇敢的心☆):
    不知道什么是“连接格式”哦,可否讲讲或者从哪里可以找到资料?to ftofficer(编程菜鸟):
    我是用了第三方库CJ60Lib,但这是个界面库,压根儿不会去定义operator delete的。
    根据提示可以知道,是nafxcwd.lib(MFC库)和libcpmtd.lib(标准C++库)之间的重定义冲突。现在的问题是:我怎么样才能消除这种冲突啊?
    注:我这个项目中用到了一些ATL和Socket,但我保证我除了在Link标签里添加了一个库模块cj60lib.lib之外,没动过工程设置里的其他东西。(不过在Winzad里这个工程是采用动态连接的,但现在我想静态连接了。)