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

  • Thread starter Thread starter Guest
  • Start date Start date
G

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
{
};
}
 
I think that you link your project with the static release C Runtime instead
of the static debug C Runtime on a debug configuration.
 
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. :-)
 
Back
Top