473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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(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
{
};
}
Nov 16 '05 #1
2 7607
I think that you link your project with the static release C Runtime instead
of the static debug C Runtime on a debug configuration.

<Ol**********@skyscan.be> wrote in message
news:3f*********************@reader0.news.skynet.b e...
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
{
};
}

Nov 16 '05 #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.

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. :-)
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mysooru | last post by:
How to restrict an object to be instantiated only using new operator? I mean, one should not be allowed to create an object like AnObject obj; it should be AnObject obj = new AnObject;
3
by: Mikhail | last post by:
Hi , Does anybody know -how many elements could be in SQL operator IN?. As an example DELETE FROM emp WHERE ename IN (NULL, 'king',...,N); Thank you in advance .
34
by: Pmb | last post by:
I've been working on creating a Complex class for my own learning purpose (learn through doing etc.). I'm once again puzzled about something. I can't figure out how to overload the assignment...
1
by: sven_c_t | last post by:
Hi! Probably a newbie question. I´ve been working a bit with the widget toolkit FLTK and I have been wondering why there is such a heavy use of the new operator, when it does not seem to be...
13
by: gary | last post by:
Hi, We all know the below codes are dangerous: { int *p = new int; delete p; delete p; } And we also know the compilers do not delete p if p==NULL. So why compilers do not "p = NULL"...
188
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
1
by: Michael | last post by:
Hello dear .Net experts I have created a Visual C++ class library (.net) project with two classes named Base and Derived wher Derived inherits from Base. When I add a destructur to base I get the...
2
by: John Goche | last post by:
Hello, Could anyone please provide with some information on the C++ overloaded cast operator and in which circumstances this might be useful? I have consulted several references but found no...
2
by: Virtual_X | last post by:
i am beginner to c++ when i open the file "stdio.h" i have found the line _CRTIMP int __cdecl remove (const char*); and similar lines to it so what's "_CRTIMP" and "__cdecl"
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.