10-22-2018 06:32 AM
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
Solved! Go to Solution.
10-22-2018 08:59 AM
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
10-23-2018 06:31 AM - edited 10-23-2018 06:37 AM
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.
10-23-2018 07:40 AM
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
10-23-2018 08:04 AM
Thank you for this explanation. I keep this solution.
Best regards.
Didier