3

I write a small application to enter the computer to Standby Mode:

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

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

   return 0;
}

I get this error: 1>Standby.obj : error LNK2001: unresolved external symbol _SetSuspendState@12 1>C:\Documents and Settings\Sobak\Desktop\Standby\Release\Standby.exe : fatal error LNK1120: 1 unresolved externalsexternals

How can I fix it?

P.S. I use Visual Studio 2005

Thank you in advance.

Leonid F.
  • 577
  • 3
  • 5
  • 21

1 Answers1

5

You should link your programm with the PowrProf.lib library. You could do it by adding the following string:

#pragma comment(lib, "PowrProf.lib")
Kirill V. Lyadvinsky
  • 97,037
  • 24
  • 136
  • 212