Link to home
Start Free TrialLog in
Avatar of gmacgougan
gmacgougan

asked on

Linking error caused by mixing MFC and non MFC style code

I've been trying to include a few files such as my own Matrix library with an MFC app. The problem I run into is a linking error caused by two libraries defining the same symbol.

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,int,char const *,int)" (??2@YAPAXIHPBDH@Z) already defined in LIBCMTD.lib(dbgnew.obj)
Debug/TestStaticPos.exe : fatal error LNK1169: one or more multiply defined symbols found

The non-MFC code is not using a precompiled header.I know its caused by something in the project settings but I haven't been able to track it down.

If you've seen this before and have found a way around it, Please respond.
ASKER CERTIFIED SOLUTION
Avatar of wyy_cq
wyy_cq

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gmacgougan
gmacgougan

ASKER

It worked