Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.2
-
None
-
OS: windows_64bit
compiler: GCC 11.2.0 +MinGW-w64 9.0.0 (MSVCRT) - release 3 download from winlibs.com
qt:qt-everywhere-src-5.15.2.tar.xz from download.qt.io
-
-
7c713c4d2c176dbc4fa7eb0a670aa86e49f36716 (6.2.2) 6652bf2353d807f724f398a15cb22c188830f57c (6.3)
Description
I got Gcc11.2 from winlibs.com,While configuring qt5.15.2 I got errors:
D:/QTFOlder/qt5/qtbase/src/corelib/io/qfilesystemengine_win.cpp:669:16: error: redefinition of 'struct _FILE_ID_INFO'
669 | typedef struct _FILE_ID_INFO {
^~~~~~~~~~~~~ In file included from d:\opt\mingw64\x86_64-w64-mingw32\include\windows.h:70, from d:\qtfolder\qt5\qtbase\src\corelib\global\qt_windows.h:64, from D:/QTFOlder/qt5/qtbase/include/QtCore/qt_windows.h:1, from D:/QTFOlder/qt5/qtbase/src/corelib/io/qfilesystemmetadata_p.h:61, from D:/QTFOlder/qt5/qtbase/src/corelib/io/qfilesystemengine_p.h:56, from D:/QTFOlder/qt5/qtbase/src/corelib/io/qfilesystemengine_win.cpp:40: d:\opt\mingw64\x86_64-w64-mingw32\include\winbase.h:3140:18: note: previous definition of 'struct _FILE_ID_INFO' |
My configre option:
configure.bat -shared -confirm-license -opensource -debug-and-release -platform win32-g++ -prefix "d:\qt\MinGW64_112" -nomake tests -no-compile-examples -skip qtlottie -skip qtwayland -skip qtpurchasing -skip qtspeech -skip qtgamepad -skip qtlocation -skip qtnetworkauth -opengl desktop -recheck-all
Follow the error message I found
\qtbase\src\corelib\io\qfilesystemengine_win.cpp
#if defined(Q_CC_MINGW) && WINVER< 0x0602 // Windows 8 onwards typedef struct _FILE_ID_INFO { ULONGLONG VolumeSerialNumber; FILE_ID_128 FileId; } FILE_ID_INFO, *PFILE_ID_INFO;
\qtbase\src\corelib\global\qt_windows.h
#if defined(Q_CC_MINGW) // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation # ifndef WINVER # define WINVER 0x601 # endif # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x601 # endif # ifndef NTDDI_VERSION # define NTDDI_VERSION 0x06000000 # endif #endif #ifndef NOMINMAX # define NOMINMAX #endif #include <windows.h>
windows.h was included after the WINVER defintion in qt_windows.h. But in fact the _WIN32_WINNT was set to 0x0A00 in _mingw.h which has been included in mingw's windows.h。
so I include windows.h before winver definition in the file , it seems work but i'm not sure.
#include <windows.h> #if defined(Q_CC_MINGW) // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation # ifndef WINVER # define WINVER 0x601 # endif // …… //#include <windows.h>