PDA

View Full Version : Visual C++.NET : LNK2005


lin_space
10-05-2006, 03:23 AM
Hi,

When i build my project i have the following linking errors:

nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator
new(unsigned int)" (??2@YAPAXI@Z) déjà défini(e) dans
libcpmtd.lib(newop.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
delete(void *)" (??3@YAXPAX@Z) déjà défini(e) dans
libcmtd.lib(dbgdel.obj)

For information, i'm working on the C++.NET language and i'm using a
software solution api with external libraries. I encountred a similar
problem when working on a win32 console application project and i
resolved it by ignoring the libraries that caused the problem and
reinserting them in the right order (in the project properties). When i
took the same code into a C++.NET project, this procedure didn't work.

Can anyone help me solving this problem !!!

.oisyn
10-05-2006, 03:57 AM
Oh my god, a french linker :lol:

Well, my french is a bit rusty, but "déjà défini(e) dans" translates to "already defined in", right? It appears that you're using multiple libraries that each include their own operator new() implementation. It also appears that this problem is known by microsoft: http://support.microsoft.com/kb/q148652/ (first hit on google when searching for nafxcwd.lib)

lin_space
10-05-2006, 05:21 AM
I tried the microsoft first solution (ordering the libraries) before submitting to this group, but without any result; and i didn't understand how i can use the second solution : i set the "/verbose:lib" in the linker command line and didn't know how to procede to locate and correct the module that causes the problem !!!