I just created a new project (Win32 Console Application) in visual studio 2017 RC, and coded this, that, as far as my understanding goes, should be working.
#include "stdafx.h"
#include <string>
#include <iostream>
#include <windows.h>
#include "PowrProf.h Or Powerbase.h"
using namespace std;
int main(int argc, _TCHAR* argv[])
{
SYSTEM_POWER_POLICY PowerPlugged;
SYSTEM_POWER_POLICY PowerUnPlugged;
POWER_ACTION_POLICY ActionPlugged;
POWER_ACTION_POLICY ActionUnPlugged;
CallNtPowerInformation(SystemPowerPolicyAc, NULL, 0, &PowerPlugged, sizeof(SYSTEM_POWER_POLICY));
CallNtPowerInformation(SystemPowerPolicyDc, NULL, 0, &PowerUnPlugged, sizeof(SYSTEM_POWER_POLICY));
ActionPlugged.Action = PowerActionNone;
ActionUnPlugged.Action = PowerActionNone;
PowerPlugged.LidClose = ActionPlugged;
PowerUnPlugged.LidClose = ActionUnPlugged;
CallNtPowerInformation(SystemPowerPolicyAc, &PowerPlugged, sizeof(SYSTEM_POWER_POLICY), NULL, 0);
CallNtPowerInformation(SystemPowerPolicyDc, &PowerUnPlugged, sizeof(SYSTEM_POWER_POLICY), NULL, 0);
string yaes;
getline(cin, yaes);
return 0;
}
Now I'm sorry if this is a dumb question, but I really never had to deal with the Linker, and the code gives me no errors. Except for when building of course.
The remarks section of the documentation says nothing about this.
I am on windows 10 and I've tried including Powerbase.h, PowrProf.h. Both gave me the exact same errors:
LNK2019: unresolved external symbol _CallNtPowerInformation@20 referenced in function _main BatterySettings c:\Users\badmouthing\documents\visual studio 2017\Projects\BatterySettings\BatterySettings\BatterySettings.obj
And of course
LNK1120 1 unresolved externals BatterySettings c:\users\profanity(I'm just having fun, the username is the same)\documents\visual studio 2017\Projects\BatterySettings\Debug\BatterySettings.exe
So what am I doing wrong? Thank you.