LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't compiling when using HW_PROFILE_INFO of GetCurrentHwProfileA SDK function

Solved!
Go to solution

Hello,

I've add a SDK function in an old program under CVI 9.0 and Windows 7.

This function is GetCurrentHwProfileA (or without A at the end of the name).

I've write Microsoft sample in a file to my project.

 

HW_PROFILE_INFO profil;    
 GetCurrentHwProfile(&profil);
 

The problem is that HW_PROFILE_INFO structure is not found by the compiler.

I got error message: "Undeclared identifier 'HW_PROFILE_INFO' even if I've add winbase.h after Windows.h header. winbase.h already existes in the "\National Instruments\CVI90\sdk\include\" folder.

Util.c - 4 errors
 126, 1   Undeclared identifier 'HW_PROFILE_INFO'.
 126, 17   syntax error; found 'identifier' expecting ';'.
 126, 17   Undeclared identifier 'profil'.
 127, 5   Missing prototype.

 

I tried to add recommanded macro /D_WIN32_WINNT=_WIN32_WINNT_WIN7, but without any sucess.

Is there somebody to help me and tell me what to do to solve this issue?

Best regards.

Didier

Didier
0 Kudos
Message 1 of 5
(2,949 Views)

I'm afraid CVI 9.0 has an older Windows SDK that doesn't know about _WIN32_WINNT_WIN7. Try using 0x0601 instead

/D_WIN32_WINNT=0x0601
0 Kudos
Message 2 of 5
(2,931 Views)

Thank you ConstantinP.

That compiles now and I get what I wanted. However this generates warnings at winbase.h that I would like to avoid.

 "WinBase.h"(1630,1)   Warning: Static '__int64 function(pointer to volatile __int64,__int64) InterlockedAnd64' is not referenced.

#if (_WIN32_WINNT >= 0x0502)

LONGLONG

I've tried with /D_WIN32_WINNT=0x0501 and warnings have been cleared.

Can this solution affect the rest of my program? Do you think it is a good solution?

Didier.

Didier
0 Kudos
Message 3 of 5
(2,921 Views)
Solution
Accepted by topic author DidierR

Setting _WIN32_WINNT to 0x0501 should be OK. If the value is lower you cannot use some features, like it was with GetCurrentHwProfile when _WIN32_WINNT was not defined. You'll know if you need a higher version when you need to use something and you get errors like it was with the initial issue

0 Kudos
Message 4 of 5
(2,912 Views)

Thank you for this explanation. I keep this solution.
Best regards.

Didier


 

Didier
0 Kudos
Message 5 of 5
(2,908 Views)