It appears that you are trying to build an MFC application. The MFC framework implements its own custom versions of new and delete. I don't recommend trying to replace the framework's memory management implementation.
LNK2005 error on C++ app when implementing a replacement new and delete
Mike Nice
20
Reputation points
In Visual Studio 2019 C++14 I can build a "hello world" program with a custom new and delete.
I'm unable to link a larger program which implements a custom new and delete replacement.
The error is
LNK2005 "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in nafxcw.lib(afxmem.obj)
I've tried all the suggestions listed at
Also trying to understand the verbose Link output.
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,960 questions