Link to home
Start Free TrialLog in
Avatar of yeshengl
yeshenglFlag for United States of America

asked on

GetCurrentHwProfile, HW_PROFILE_INFO won't compile!

Hi,

I tried to use GetCurrentHwProfile(&hwp) and HW_PROFILE_INFO hwp. I already included windows.h. But they just won't compile. The compiler tells:
'HW_PROFILE_INFO' : undeclared identifier
'GetCurrentHwProfile' : undeclared identifier

So what is the problem and how can I make them compile. Thanks a lot!
Avatar of aib_42
aib_42

Are you able to include windows.h without any problems? (You should be)
Are HW_PROFILE_INFO and GetCurrentHwProfile somehow defined in windows.h? (They should be)
The HW_PROFILE_INFO hwp; line is before GetCurrentHwProfile, right? (It should be)
Avatar of yeshengl

ASKER

Are you able to include windows.h without any problems? (You should be)
Yes, I am able to include windows.h

Are HW_PROFILE_INFO and GetCurrentHwProfile somehow defined in windows.h? (They should be)
No. Actually HW_PROFILE_INFO and GetCurrentHwProfile are defined in winbase.h. From the MSDN, you can see their including information as: Header: Declared in Winbase.h; include Windows.h.

And I included both windows.h and winbase.h, it still does not compile.

The HW_PROFILE_INFO hwp; line is before GetCurrentHwProfile, right? (It should be)
Yes. It is like this:

HW_PROFILE_INFO   HwProfInfo;
if (!GetCurrentHwProfile(&HwProfInfo))
{
    _tprintf(TEXT("GetCurrentHwProfile failed with error %lx\n"),
    GetLastError());
    return;
}

But it won't compile. The compile error:
    error C2065: 'HW_PROFILE_INFO' : undeclared identifier
    error C2146: syntax error : missing ';' before identifier 'HwProfInfo'
    error C2065: 'HwProfInfo' : undeclared identifier
    error C2065: 'GetCurrentHwProfile' : undeclared identifier
ASKER CERTIFIED SOLUTION
Avatar of aib_42
aib_42

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial