C++ 使用GetPwrCapabilities时出错

C++ 使用GetPwrCapabilities时出错,c++,winapi,processor,C++,Winapi,Processor,我正在尝试运行以下代码以读取最大处理器限制: #include <iostream> #include <string> #include <tchar.h> #include <windows.h> #include <Powerbase.h> #include <PowrProf.h> using namespace std; int main() { SYSTEM_POWER_CAPABILITIES sy

我正在尝试运行以下代码以读取最大处理器限制:

#include <iostream>
#include <string>
#include <tchar.h>
#include <windows.h>
#include <Powerbase.h>
#include <PowrProf.h>

using namespace std;

int main()
{
    SYSTEM_POWER_CAPABILITIES sysc;

    while (GetPwrCapabilities(&sysc)) {
        cout << " Your Max Throttle is: " << static_cast<double>    (sysc.ProcessorMaxThrottle) << endl;
    }

    Sleep(10000);
    return 0;
}
#包括
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
int main()
{
系统动力能力系统;
while(GetPwrCapabilities(&sysc)){

cout要使其工作,您需要将
powrpof.lib
添加到项目设置中:

Project Properties -> Linker -> Input -> Additional Dependencies