To make it work, you need to add PowrProf.lib
to your project setting:
Project Properties -> Linker -> Input -> Additional Dependencies
Question
I am trying to run the following code to read the max processor throttle:
#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;
}
However , I am receiving the following error:
...error LNK2019: unresolved external symbol _GetPwrCapabilities@4 referenced in function _main ...fatal error LNK1120: 1 unresolved externals
I tried the solution related to make sure the linker set to console program but it does not work. Any suggestion ? I am using MSVS 2013. Thanks
Solution
To make it work, you need to add PowrProf.lib
to your project setting:
Project Properties -> Linker -> Input -> Additional Dependencies