I modified code to: #include <windows.h> #include "psapi.h" #include <stdio.h> #include <stdlib.h> #pragma comment ( lib, "psapi.lib" ) void GetCurrentProcessMemory () { PROCESS_MEMORY_COUNTERS pmc; printf("{\n}"); bool ret=GetProcessMemoryInfo ( GetCurrentProcess() , &pmc, sizeof ( pmc ) ); if (ret) printf("\n[successed: %d]", (int)pmc.WorkingSetSize); else printf("\n<failed>"); printf("{\n}"); } int main() { GetCurrentProcessMemory(); return 0; } I can compile it on my debian with: i586-mingw32msvc-gcc foo.cpp -lpsapi