0 down vote favorite
I am using windows api to get various hardware info such as cpu usage and battery info. I have been trying to get the names of the names of the battery devices by following this guide http://msdn.microsoft.com/en-us/library/windows/desktop/bb204769%28v=vs.85%29.aspx but i am stuck when i get to here.
but i am getting the following error
i am a beginner in c++ so i might be missing something obvious but this is how they do it in the guide. Any advice would be great.
I am using windows api to get various hardware info such as cpu usage and battery info. I have been trying to get the names of the names of the battery devices by following this guide http://msdn.microsoft.com/en-us/library/windows/desktop/bb204769%28v=vs.85%29.aspx but i am stuck when i get to here.
#define INITGUID
#include<windows.h>
#include<batclass.h>
#include<setupapi.h>
#include<devguid.h>
using namespace std;
int main()
{
HDEVINFO hdev = SetupDiGetClassDevs(&GUID_DEVCLASS_BATTERY, 0, 0, DIGCF_PRESENT
| DIGCF_DEVICEINTERFACE);
}
but i am getting the following error
[Linker error] C:\Users\Owner\AppData\Local\Temp\ccTMeaf9.o:Untitled1.cpp:(.text+0x28): undefined reference to `__imp_SetupDiGetClassDevsA' collect2: ld returned 1 exit status
i am a beginner in c++ so i might be missing something obvious but this is how they do it in the guide. Any advice would be great.