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

Discussion in 'Microsoft VC .NET' started by Guest, Aug 7, 2003.

  1. Guest

    Guest Guest

    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(dbgdel.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
    {
    };
    }
     
    Guest, Aug 7, 2003
    #1
    1. Advertisements

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



    <> wrote in message
    news:3f321587$0$314$...
    > 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(dbgdel.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, Aug 7, 2003
    #2
    1. Advertisements

  3. Guest

    Guest Guest

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

    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. :)
     
    Guest, Aug 7, 2003
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    423
    Ralf Jablonski
    Mar 5, 2004
  2. Guest
    Replies:
    1
    Views:
    1,951
    Mike DeKoker
    Mar 23, 2004
  3. Bruce Schechter
    Replies:
    7
    Views:
    1,394
    Gary Chang
    Jun 8, 2004
  4. Marcus Kwok

    void vs. System::Void

    Marcus Kwok, Feb 20, 2006, in forum: Microsoft VC .NET
    Replies:
    2
    Views:
    525
    Marcus Kwok
    Feb 20, 2006
  5. Replies:
    2
    Views:
    474
    Ben Voigt
    Sep 11, 2006
Loading...

Share This Page