This topic is now archived and is closed to further replies.


mods to crtdbg working except with STL

Recommended Posts

DanG    122
I am working on using the crtdbg memory tracking functions. One thing I am doing is fixing the problem with getting erroneous file and line info in the debug report (when _CRTDBG_MAP_ALLOC is defined). My change I added to the top of my file is: inline void __cdecl operator delete(void * p, const char* sFile, int nLine) { ::operator delete(p); } inline void* __cdecl operator new(unsigned int s, const char* sFile, int nLine) { return ::operator new(s, _NORMAL_BLOCK, sFile, nLine); } #ifdef _DEBUG #define new new(__FILE__, __LINE__) #endif This works fine for almost everything I''ve done so far, until I start using the STL. As soon as #include <iostream>, I get this compiler error: include\xmemory(29) : error C2665: ''new'' : none of the 5 overloads can convert parameter 1 from type ''char [62]'' Whats up with that? My best guess so far is that xmemory is using a different version new and my macro is mangling it, but I''m not sure. Any ideas?

Share this post

Link to post
Share on other sites