我正在学习vc ++并使用代码检查内存的使用信息.这个程序给了我三个未解决的外部错误..
error LNK2019: unresolved external symbol _GetProcessMemoryInfo@12 referenced
in function "void __cdecl PrintMemoryInfo(unsigned long)"
(?PrintMemoryInfo@@YAXK@Z)
error LNK2019: unresolved external symbol _EnumProcesses@12 referenced in
function _main
error LNK1120: 2 unresolved externals.
Run Code Online (Sandbox Code Playgroud)
码::
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <psapi.h>
// To ensure correct resolution of symbols, add Psapi.lib to TARGETLIBS
// and compile with -DPSAPI_VERSION=1
void PrintMemoryInfo( DWORD processID )
{
HANDLE hProcess;
PROCESS_MEMORY_COUNTERS pmc;
// Print the process identifier.
printf( "\nProcess ID: %u\n", processID );
// Print information …Run Code Online (Sandbox Code Playgroud)