troubleshooting Question

Lnk2005 error

Avatar of Tamije
Tamije asked on
C++
7 Comments1 Solution2340 ViewsLast Modified:
Hi Experts

I'm developing a C++ DLL project that was working properly till yesterday. And suddenly today, it is giving the following link error when I tried to build it. The frustrating part is I did not make any changes to the project !!!

----------------------------------
Linking...
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj)
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)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in LIBCMTD.lib(new2.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCMTD.lib(delete2.obj)
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in LIBCMTD.lib(new2.obj); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCMTD.lib(delete2.obj); second definition ignored
   Creating library Debug/SingleEndFaultLocation.lib and object Debug/SingleEndFaultLocation.exp
Debug/SingleEndFaultLocation.dll : fatal error LNK1169: one or more multiply defined symbols found

----------------------------------

I searched other threads for this error. But still not able to figure out how to solve it.


In my project, if I comment out the following line, then the link error disppears.
#include <AfxTempl.h>

But I need this header to use CArray template.

Can somebody please help me in solving this problem.

Thanks
Tamije
ASKER CERTIFIED SOLUTION
itsmeandnobodyelse

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros