LNK2005: "void __cdecl operator delete(void *)" ......

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    #1

    LNK2005: "void __cdecl operator delete(void *)" ......

    My hear is dropping out of these linker errors of VC++ .NET. :-(
    I try to create a mixed managed/unmanaged .NET dll to be used for my futur
    projects, but I always bump in a linker error and no way to get around
    this...

    The error is: sLibBase error LNK2005: "void __cdecl operator delete(void *)"
    (??3@YAXPAX@Z) already defined in libcmtd.lib(dbg del.obj)

    These are 2 the same header files. The first uses <string> and generates the
    link error.
    If I remove this <string> then the linker does not get an error.

    It is not only <string > the gives this error, also includes with <istream>
    and <ostream>,... and my code uses <string> dramatically.

    Any idea how to fix this? I found references to this problem on msdn, but
    that is for VC 6 and the sollutions suggested doesn't solve this error.

    Any help would be great.


    This generates the link error
    ----------------------------------------------
    #pragma once
    using namespace System;
    #include <afx.h>
    #include <string>

    namespace sLibBase
    {
    public __gc class Class1
    {
    };
    }


    This generates no link error
    ----------------------------------------------
    #pragma once
    using namespace System;
    #include <afx.h>

    namespace sLibBase
    {
    public __gc class Class1
    {
    };
    }


  • Lionel Schiepers

    #2
    Re: LNK2005: &quot;void __cdecl operator delete(void *)&quot; ......

    I think that you link your project with the static release C Runtime instead
    of the static debug C Runtime on a debug configuration.



    <Olaf.Baeyens@s kyscan.be> wrote in message
    news:3f321587$0 $314$ba620e4c@r eader0.news.sky net.be...[color=blue]
    > My hear is dropping out of these linker errors of VC++ .NET. :-(
    > I try to create a mixed managed/unmanaged .NET dll to be used for my futur
    > projects, but I always bump in a linker error and no way to get around
    > this...
    >
    > The error is: sLibBase error LNK2005: "void __cdecl operator delete(void[/color]
    *)"[color=blue]
    > (??3@YAXPAX@Z) already defined in libcmtd.lib(dbg del.obj)
    >
    > These are 2 the same header files. The first uses <string> and generates[/color]
    the[color=blue]
    > link error.
    > If I remove this <string> then the linker does not get an error.
    >
    > It is not only <string > the gives this error, also includes with[/color]
    <istream>[color=blue]
    > and <ostream>,... and my code uses <string> dramatically.
    >
    > Any idea how to fix this? I found references to this problem on msdn, but
    > that is for VC 6 and the sollutions suggested doesn't solve this error.
    >
    > Any help would be great.
    >
    >
    > This generates the link error
    > ----------------------------------------------
    > #pragma once
    > using namespace System;
    > #include <afx.h>
    > #include <string>
    >
    > namespace sLibBase
    > {
    > public __gc class Class1
    > {
    > };
    > }
    >
    >
    > This generates no link error
    > ----------------------------------------------
    > #pragma once
    > using namespace System;
    > #include <afx.h>
    >
    > namespace sLibBase
    > {
    > public __gc class Class1
    > {
    > };
    > }
    >
    >[/color]


    Comment

    • Guest's Avatar

      #3
      Re: LNK2005: &quot;void __cdecl operator delete(void *)&quot; ......

      > I think that you link your project with the static release C Runtime
      instead[color=blue]
      > of the static debug C Runtime on a debug configuration.
      >[/color]
      It was not that but you gave me some new ideas and instead of statically
      linking MFC I link now dynamic.
      This solved my link errors. An dfinally it seems that then unmanaged code
      also works for me now. :-)


      Comment

      Working...