我编写了一个小应用程序来使计算机进入待机模式:

#include "stdafx.h"
#include <windows.h>
#include <PowrProf.h>

int _tmain(int argc, _TCHAR* argv[])
{
   SetSuspendState(FALSE, FALSE, FALSE);

   return 0;
}

我收到此错误:1>待机.obj:错误LNK2001:未解决的外部符号_setsuspendstate@12 1> c: document and stayings sobak desktop standby standby standby repares standby.exe:exe:exe:exe:致命错误 LNK1120:1 个未解决的外部外部

我该如何修复它?

附:我使用 Visual Studio 2005

先感谢您。

有帮助吗?

解决方案

您应该将您的程序链接到 PowrProf.lib 图书馆。您可以通过添加以下字符串来做到这一点:

#pragma comment(lib, "PowrProf.lib")
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top