开发者

Suspending system using c++ program

I am trying to suspend my system using a c++ program using SetSuspendState method but I am facing issue during linking.

I am using g++-4 (GCC) 4.3.4 20090804 (release) 1 compiler on Windows 7 OS (64bit).

The code I have written is

#include <iostream>
#include "windows.h"
#include "powrprof.h"

using namespace std;

int main() {

    cout << SetSuspendState(false, true, false);
    return 0;
}

Following is the error 开发者_开发百科I am facing:

/cygdrive/c/Users/Vikas/AppData/Local/Temp/ccFpLgPi.o:suspend.cpp:(.text+0xa4): undefined reference to `_SetSuspendState@12' collect2: ld returned 1 exit status

Kindly help me in resolving this issue.

Thanks in advance ...


I believe dlltool can be used to create import libraries from DLLs for use with GCC under Cygwin. The DLL exporting the functions pwrprof.dll should be located in your Windows system directory somewhere.


As msdn says you need to link PowrProf.lib.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜