Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Link Errors Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Jaap Suter

May 21, 1999, 04:50 PM

I got some anoying link errors since i started using the new and delete operators.

Can anybody help me? If i don't use new and delete everything is ok but i really need them. The errors are the following:

-------------------Configuration: ShowCase - Win32 Debug--------------------
Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
Debug/ShowCase.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

ShowCase.exe - 3 error(s), 0 warning(s)

I link MFC as a static library. Further more i link dxguid.lib ddraw.lib d3dim.lib and winmm.lib. The only headers i use which are not written by me are: afx.h and mmsystem.h

Can anybody please help. I need to get this program working soon :)

Thanks!

Jaap Suter

 
mordell

May 26, 1999, 11:14 AM

Jaap,

Ever get this resolved?

If not, I think I may have run into this before.

I seem to recall MS re-defining new with code similar to this:

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

This code was inserted at the top of each source file generated by like classwizard or something.

I know its odd, but if I commented out this code, everthing compiled fine.

HTH,

-mordell

Jaap Suter wrote:
>>I got some anoying link errors since i started using the new and delete operators.
>>
>>Can anybody help me? If i don't use new and delete everything is ok but i really need them. The errors are the following:
>>
>>-------------------Configuration: ShowCase - Win32 Debug--------------------
>>Linking...
>>nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
>>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
>>Debug/ShowCase.exe : fatal error LNK1169: one or more multiply defined symbols found
>>Error executing link.exe.
>>
>>ShowCase.exe - 3 error(s), 0 warning(s)
>>
>>I link MFC as a static library. Further more i link dxguid.lib ddraw.lib d3dim.lib and winmm.lib. The only headers i use which are not written by me are: afx.h and mmsystem.h
>>
>>Can anybody please help. I need to get this program working soon :)
>>
>>Thanks!
>>
>>Jaap Suter

 
This thread contains 2 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.