EDN Admin
Well-known member
Hi,
The code in the link http://msdn.microsoft.com/en-us/library/19f56tw3(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/19f56tw3(v=vs.110).aspx for Debug Heap for C++ on Visual Studio 2012 seems does not work when using std.
my code like this:
<pre style="padding:5px; font-family:Consolas,Courier,monospace; word-break:break-all; word-wrap:break-word; font-size:13px; line-height:normal; text-align:left /* MyDbgNew.h
Defines global operator new to allocate from
client blocks
*/
#ifdef _DEBUG
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
#define DEBUG_CLIENTBLOCK
#endif // _DEBUG
/* MyApp.cpp
Use a default workspace for a Console Application to
* build a Debug version of this code
*/
#include "crtdbg.h"
#include "mydbgnew.h"
#ifdef _DEBUG
#define new DEBUG_CLIENTBLOCK
#endif #include <vector> using std::vector; class A { vector <int> vecInt; }; int main( ) {
char *p1;
p1 = new char[40]; A* pA = new pA(); _CrtMemDumpAllObjectsSince( NULL );
} If I remove class A it worked well, but when add class A and use std::vector, these is a link error: error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z) referenced in function __unwindfunclet$_main$0 Why this happen in Visual Studio 2012?? [/code]
View the full article
The code in the link http://msdn.microsoft.com/en-us/library/19f56tw3(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/19f56tw3(v=vs.110).aspx for Debug Heap for C++ on Visual Studio 2012 seems does not work when using std.
my code like this:
<pre style="padding:5px; font-family:Consolas,Courier,monospace; word-break:break-all; word-wrap:break-word; font-size:13px; line-height:normal; text-align:left /* MyDbgNew.h
Defines global operator new to allocate from
client blocks
*/
#ifdef _DEBUG
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
#define DEBUG_CLIENTBLOCK
#endif // _DEBUG
/* MyApp.cpp
Use a default workspace for a Console Application to
* build a Debug version of this code
*/
#include "crtdbg.h"
#include "mydbgnew.h"
#ifdef _DEBUG
#define new DEBUG_CLIENTBLOCK
#endif #include <vector> using std::vector; class A { vector <int> vecInt; }; int main( ) {
char *p1;
p1 = new char[40]; A* pA = new pA(); _CrtMemDumpAllObjectsSince( NULL );
} If I remove class A it worked well, but when add class A and use std::vector, these is a link error: error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z) referenced in function __unwindfunclet$_main$0 Why this happen in Visual Studio 2012?? [/code]
View the full article