-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.9.0, 6.9.1, 6.9.2
-
None
-
Windows 10 21H2
Visual Studio 17.9.7
Windows 10 SDK 10.0.19041.0
Full compilation of Qt 6.9.2 fails with the following error while using Windows 10 SDK 19041:
Building CXX object qtbase\src\plugins\platforms\windows\CMakeFiles\QWindowsIntegrationPlugin.dir\qwindowswindow.cpp.obj FAILED: qtbase/src/plugins/platforms/windows/CMakeFiles/QWindowsIntegrationPlugin.dir/qwindowswindow.cpp.obj C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\cl.exe /nologo /TP -DNOMINMAX -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_GUI_LIB -DQT_LEAN_HEADERS=1 -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QASCONST -DQT_NO_QEXCHANGE -DQT_NO_QSNPRINTF -DQT_NO_STD_FORMAT_SUPPORT -DQT_OPENGL_LIB -DQT_PLUGIN -DQT_USE_QSTRINGBUILDER -DQWindowsIntegrationPlugin_EXPORTS -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\src\plugins\platforms\windows\QWindowsIntegrationPlugin_autogen\include -IC:\dev\src\qt-everywhere-src-6.9.2\qtbase\src\plugins\platforms\windows -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\src\plugins\platforms\windows -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include -IC:\dev\src\qt-everywhere-src-6.9.2\qtbase\src\3rdparty\wintab -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtCore -IC:\dev\src\qt-everywhere-src-6.9.2\qtbase\mkspecs\win32-msvc -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\src\corelib -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtCore\6.9.2 -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtCore\6.9.2\QtCore -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtGui -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\src\gui -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtGui\6.9.2 -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtGui\6.9.2\QtGui -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtOpenGL -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\src\opengl -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtOpenGL\6.9.2 -IC:\dev\tmp\build\Qt-6.9.2-shared\x64\Release\qtbase\include\QtOpenGL\6.9.2\QtOpenGL /DWIN32 /D_WINDOWS /DNDEBUG -O1 -std:c++17 -MD /W3 -Zc:__cplusplus -permissive- -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:ternary -Zc:externConstexpr -Zc:wchar_t -bigobj -guard:cf -Gw /EHs-c- /wd4530 /wd4577 /showIncludes /Foqtbase\src\plugins\platforms\windows\CMakeFiles\QWindowsIntegrationPlugin.dir\qwindowswindow.cpp.obj /Fdqtbase\src\plugins\platforms\windows\CMakeFiles\QWindowsIntegrationPlugin.dir\ /FS -c C:\dev\src\qt-everywhere-src-6.9.2\qtbase\src\plugins\platforms\windows\qwindowswindow.cpp C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(479): error C3861: 'min': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(480): error C3861: 'min': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(481): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(482): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(503): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(504): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(505): error C3861: 'min': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(506): error C3861: 'min': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(667): error C3861: 'min': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(668): error C3861: 'min': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(669): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(670): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(691): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(692): error C3861: 'max': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(693): error C3861: 'min': identifier not found C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\GdiplusTypes.h(694): error C3861: 'min': identifier not found ninja: build stopped: subcommand failed.
This is a known problem[1] when including GdiplusTypes.h while 'NOMINMAX' has previously been defined and was fixed in subsequent versions of the Windows 10 SDK (2104) [2].
Technically Qt has done nothing "wrong", and the qwindowswindow.cpp file compiles fine against the new Windows 10 and Windows 11 SDKs but the official documentation does claim support for SDKs as far back as 10.0.17763 [3].
I was able to get it to compile on my machine with the following change to qwindowswindow.cpp:
#ifndef min # define min_defined_locally # define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #ifndef max # define max_defined_locally # define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #include <gdiplus.h> //<-- required min & max macros until Windows 10 SDK 2104 #ifdef min_defined_locally # undef min #endif #ifdef max_defined_locally # undef max #endif
[1]: https://developercommunity.visualstudio.com/t/GdiplusTypesh-does-not-compile-with-NOM/727770
[2]: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/
[3]: https://doc.qt.io/qt-6/windows-building.html
For Gerrit Dashboard: QTBUG-139653 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
673040,2 | WindowsQPA: Remove unused GDIPlus include from qwindowswindow.cpp | dev | qt/qtbase | Status: NEW | 0 | 0 |