error redefinition of 'struct _FILE_ID_INFO'
-
Hi, dear community members. Today I tried to compile Qt 5.15.5 with MinGW under Windows, but I got some errors while configuring.
In file included from d:\opt\mingw64\x86_64-w64-mingw32\include\windows.h:70,
from F:\qt5\qtbase\src\corelib\global\qt_windows.h:64,
from F:/qt5/qtbase/include/QtCore/qt_windows.h:1,
from F:/qt5/qtbase/src/corelib/io/qfilesystemmetadata_p.h:61,
from F:/qt5/qtbase/src/corelib/io/qfilesystemengine_p.h:56,
from F:/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'Is there any solution please? I think I use MinGW to compile the Qt 5.15 source code, and I am not the only one who encounters this configuration error. Looking forward to your reply~
-
I would guess the mingw version is too old. Make sure to use the one (or newer) as stated in the documentation.
-
I would guess the mingw version is too old. Make sure to use the one (or newer) as stated in the documentation.
@Christian-Ehrlicher
First of all, thank you very much for taking the time out of your busy schedule to reply to my post. sincere thanks! The MinGW version I am using is the MinGW 9.X version downloaded from winlibs.com. But after the first failure, I changed the official MinGW version [https://www.mingw-w64.org] and the configuration still failed again. So I tried to modify the file \qtbase\src\corelib\global\qt_windows.hThe original content is as follows:
#if defined(Q_CC_MINGW)
// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
#ifndef WINVER
#define WINVER 0x601
#endififndef _WIN32_WINNT
#define _WIN32_WINNT 0x601
#endififndef NTDDI_VERSION
#define NTDDI_VERSION 0x06000000
#endif
#endif#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>After modification as follows:
#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
#endifIn fact, #include <windows.h> is placed above the Q_CC_MINGW macro, so that the configuration is successfully passed. But I don't know if this modification will have any incalculable hidden impact on a module function of Qt.
Looking forward to your reply.
-
Hi,
Why not use the MinGW version that is provided through the Qt installer ?
-
@SGaist
Hello and welcome to my post! The Qt online installer provides 5.15.2. And the official has released the source code of Qt 5.15.5. So I want to manually compile the latest version of the 5.15 LTS series. And there will be the source code for 5.15.6 on September 8th. The official binary distribution version is no longer available for open source users, so manual compilation is required. At present, the successful compilation of MSVC has been completed, and it is worse than that of MinGW. . . -
@SGaist
Hello and welcome to my post! The Qt online installer provides 5.15.2. And the official has released the source code of Qt 5.15.5. So I want to manually compile the latest version of the 5.15 LTS series. And there will be the source code for 5.15.6 on September 8th. The official binary distribution version is no longer available for open source users, so manual compilation is required. At present, the successful compilation of MSVC has been completed, and it is worse than that of MinGW. . . -
I also have this problem, mingw1120_64 from qt6.7 online installer, cannot compile qt5.15.13.
@QtTester
Reported several times:
https://bugreports.qt.io/browse/QTBUG-94031
https://bugreports.qt.io/browse/QTBUG-101213
There's a patch you could make to the 5.x source. The fix has been rolled into Qt6