Problem building with Qt 6.8 and windows SDK includes.
-
Hey All,
I'm migrating a project from Qt 6.5.3 to Qt 6.8.2 and I'm running into some problems when compiling my project. Specifically i'm getting a lot of:
"error C2065: 'WIN32_FIND_DATAA': undeclared identifier" and similar errors for basic window types
eg. error C2065: 'HANDLE': undeclared identifier
error C2065: 'SYSTEMTIME': undeclared identifierIt's like the project is no longer able to see some of the windows SDK header files?
I've updated the msvc project file to target 143 instead of the previous 142 setting.
Changed the appropriate paths to point to the 6.8.2 Qt SDK, but otherwise only minor code changes to account for 6.8 compatibility.Both versions use VS2022, but with the 6.5.3 project targeting 142, and 6.8.2 now targeting 143 as the platform target.
I've done a compile with the show include tree option for both the previous version of the project ( that works with 6.5.3 ) and the newer version that has issues with 6.8.2, However they appear pretty similar, and basically identical for the first part.
Obviously this is because we are leveraging the Qt files to include their dependencies.the 6.5.3 version....
1>precompiled.cpp 1>Note: including file: C:\release.2.3\studio\src\precompiled.h 1>Note: including file: C:\Qt\6.5.3\msvc2019_64\include\QtWidgets/QtWidgets 1>Note: including file: C:\Qt\6.5.3\msvc2019_64\include\QtWidgets/QtWidgetsDepends 1>Note: including file: C:\Qt\6.5.3\msvc2019_64\include\QtCore/QtCore 1>Note: including file: C:\Qt\6.5.3\msvc2019_64\include\QtCore/QtCoreDepends 1>Note: including file: C:\Qt\6.5.3\msvc2019_64\include\QtCore\qglobal.h 1>Note: including file: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.29.30133\include\type_traits etc etc,
the 6.8.2 version....
1>precompiled.cpp 1>Note: including file: C:\release.2.4\studio\src\precompiled.h 1>Note: including file: C:\Qt\6.8.2\msvc2022_64\include\QtWidgets/QtWidgets 1>Note: including file: C:\Qt\6.8.2\msvc2022_64\include\QtWidgets/QtWidgetsDepends 1>Note: including file: C:\Qt\6.8.2\msvc2022_64\include\QtCore/QtCore 1>Note: including file: C:\Qt\6.8.2\msvc2022_64\include\QtCore/QtCoreDepends 1>Note: including file: C:\Qt\6.8.2\msvc2022_64\include\QtCore\qglobal.h 1>Note: including file: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.29.30133\include\type_traits etc etc
So it looks to me like there is something different in the Qt files in 6.8.2 that is causing slightly different behavior?
I use the following flags in the build process ( obvs this is from a debug build )
_WIN32_WINNT=0x0A00 WINVER=0x0A00 NTDDI_VERSION=0x0A000006 WIN32 WIN32_LEAN_AND_MEAN _CRT_SECURE_NO_DEPRECATE _WINDLL _UNICODE UNICODE
But I cant see anything that indicates I need to modify the preprocessor flags?
I've tried changing the windows SDK version in the project settings but that has no effect. I have multiple SDK's installed, but generally just default to using the most recent version.It's all a bit confusing to me. When I click on one of the unfound objects in MSVC, it's able to navigate to the file and definition correctly? eg. I can see that the SYSTEMTIME struct is defined in the minwinbase.h file
Specifically C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\minwinbase.h in my case.In both cases I can see from the include tree for the precompiled.h eventually includes the minwinbase.h file!
I've tried explicitly including the Windows.h header file where I'm getting the error, but that just gives me more problems.
And I really shouldn't need to do that, everything worked fine with Qt 6.5.3, I strongly suspect the fix here is something else.I'm on win 10, if that matters.
Thanks for any help or suggestions,
- James