【发布时间】:2015-12-23 14:59:19
【问题描述】:
我正在 Qt 5.5 中尝试通过本教程获取“当前进程当前使用的物理内存”:How to get system cpu/ram usage in c++ on Windows 当我尝试将此功能添加到我的应用程序时,我收到了一个错误...
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); // error C2664
SIZE_T physMemUsedByMe = pmc.WorkingSetSize;
错误:
C2664: 'BOOL K32GetProcessMemoryInfo(HANDLE,PPROCESS_MEMORY_COUNTERS,DWORD)' : cannot convert argument 2 from 'PROCESS_MEMORY_COUNTERS_EX *' to 'PPROCESS_MEMORY_COUNTERS'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
感谢您的帮助。
【问题讨论】:
-
阅读错误信息,删除_EX即可。
-
我的错误非常糟糕,感谢您的帮助 - 它有效。