小编use*_*546的帖子

VC++中未解决的外部错误

我正在学习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)

c++ unresolved-external lnk2019 visual-c++

5
推荐指数
2
解决办法
3115
查看次数

标签 统计

c++ ×1

lnk2019 ×1

unresolved-external ×1

visual-c++ ×1