I have an MFC SDI project that is quite big now. I need to check for memory leaks using Visual Studio. I have put in the code recommended in lots of articles I have read.
So, at the top of the source file that i want to check, I have added:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
as I want to get some info on the line that reports the leak that will allow me to find the point in the source code where he leak occurs I have put:
#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif">
now when I compile, at the linking stage I get:
myfile.obj LNK2005: "void __cdecl operator delet(void* ....etc.
already defined in uafxcwd.lib (afxmem.obj)
myapp.exe: fatal error LNK 1169: one or more multiply defined symbols defined.
Could somebody please tell me how to find memory leaks in an MFC project - it seems like there is a conflict bteween things that are already defined and what I am trying to add. I have read all that I can find but am no wiser yet (and am very frustrated :( ).