2019链接错误 - c ++

RRR*_*RRR 3 c++ linker-errors visual-studio-2010

我在VS2010中编写了以下代码片段:

#pragma once
#include "stdafx.h"
#ifndef SECURITY_WIN32
#define SECURITY_WIN32
#endif
#include "windows.h"
#include "sspi.h"

int main( void )
{
    ULONG cPackages = 0;
    PSecPkgInfo pInfo = NULL;
    SECURITY_STATUS stat = EnumerateSecurityPackages(&cPackages, &pInfo);
    if (stat == SEC_E_OK) 
    { 
        for (ULONG i = 0; i < cPackages; i++) 
        { 
            wprintf(L"%s\t%s\n",pInfo[i].Name, pInfo[i].Comment); 
        } 
        FreeContextBuffer(pInfo); 
    } 
    return 0; 

}
Run Code Online (Sandbox Code Playgroud)

但是,在编译时我遇到以下错误:

错误LNK2019:函数_main中引用的未解析的外部符号_ imp _EnumerateSecurityPackagesW @ 8

错误LNK2019:函数_main中引用了未解析的外部符号_FreeContextBuffer @ 4

谁能帮帮我吗?

Luc*_*ore 5

你需要链接Secur32.lib.

转到Project Properties -> Linker -> Input并添加Secur32.lib列表.