I am trying to calculate the primary memory usage for the current process in C language on Windows using:
windows.h psapi.h
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
SIZE_T physMemUsedByMe = pmc.WorkingSetSize;
It gives me the error:
undefined reference to getprocessmemoryinfo@12
Any idea how to fix this? My compiler is mingw32-gcc.exe