[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

GetCurrentHwProfile, HW_PROFILE_INFO won't compile!

Posted on 2004-04-08
5
Medium Priority
?
752 Views
Last Modified: 2013-12-03
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!
0
Comment
Question by:yeshengl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 7

Expert Comment

by:aib_42
ID: 10917581
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)
0
 

Author Comment

by:yeshengl
ID: 10919498
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
0
 
LVL 7

Accepted Solution

by:
aib_42 earned 200 total points
ID: 10947237
This is strange, very strange.

The SDK indeed says it is in winbase.h, but I have seen two implementations where in one, it is in windows.h and the other, winbase.h. Anyway, that should not be the problem.

Did you try manually defining the symbols? ie. Copy/Paste this from winbase.h:

typedef struct tagHW_PROFILE_INFOA {
    DWORD  dwDockInfo;
    CHAR   szHwProfileGuid[HW_PROFILE_GUIDLEN];
    CHAR   szHwProfileName[MAX_PROFILE_LEN];
} HW_PROFILE_INFOA, *LPHW_PROFILE_INFOA;

typedef HW_PROFILE_INFOA HW_PROFILE_INFO;
typedef LPHW_PROFILE_INFOA LPHW_PROFILE_INFO;

and

WINADVAPI
BOOL
WINAPI
GetCurrentHwProfileA (
    OUT LPHW_PROFILE_INFOA  lpHwProfileInfo
    );

#define GetCurrentHwProfile  GetCurrentHwProfileA

Assuming you are using the ANSI character set. (Else copy/paste the 'W' functions, or just copy paste everything)

I agree, these are strange 'solutions' or debugging steps, but your problem is strange as well.
I would also add a message, warning or error pragma to where the HWProfile stuff is being done in winbase.h:

#pragma message("OK, this part is being processed allright.")

typedef struct tagHW_PROFILE_INFOA {
...


Either that, or I am missing something very, very basic.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question