I have prepare header file "heap_monitor.h". This header work that, if I include this on some other header file, its check me any memory leak in this header and cpp file. When i forget delete objects in destructor, they stay in heap and this monitor send me error, an I know where i don't delokate memory in heap.
#pragma once
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define new new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define initHeapMonitor() _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF)
this version of code including crtdbg.h which is Windows library. In Xcode is code I don't compile with this error:
ERROR: 'crtdbg.h' file not found
I must wrote some other code to check this memory leaks or something to fix the program to compile my work without this.
when I delete crtdbg.h x code send me 20 errors in new.cpp: https://prnt.sc/iv1x7d
Know someone how I fix this problem ?