I am trying to use the C++ memory leak detection in Visual Studio 2008, but it does not work because I always get these two failures:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2365: '_CrtSetDbgFlag' : redefinition; previous definition was 'function'
I had tried putting this at the top of certain code files:
#define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
I do not understand which source/header files this is supposed to go in however, as the documentation for how to use this seems poor. It is for a CPython extension with numerous CPP/H files. Should these four lines go at the top of each and every code file?
What am I doing wrong?
您不能在全局范围内调用函数,需要将函数调用放入main
函数中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.