Important: Please read the Qt Code of Conduct -

how to compile 5.9.1 for winXP?

  • i want compile 5.9.1 for xp,but failed.
    this is my step:
    env:win10X64+vs2015; 5.9.1 opensource;
    2.create a build.bat. content like this:

    REM ********** Initialize env for msvc 2015 cl compiler **********
    SET PATH=C:\Windows;C:\Windows\system32
    REM Set up \Microsoft Visual Studio 2015, where <arch> is amd64, x86, etc.
    CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86

    REM ********** Update include & lib to support xp win sdk 7.1A **********
    SET PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
    SET INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
    SET LIB=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
    SET CL=/D_USING_V140_SDK71_;%CL%

    REM ********** 3rd party build tools binaries: ruby, perl, python **********
    SET PATH=C:\Perl\bin;C:\Python\3.6.1;%PATH%

    REM ********** Set up qt source env **********
    SET _ROOT=E:\qt5.9.1source
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    REM Uncomment the below line when using a git checkout of the source repository
    REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    SET _ROOT=

    REM Generate makefile
    E:/qt5.9.1source/configure.bat -confirm-license -opensource -platform win32-msvc2015 -debug-and-release -prefix E:\QT5.9.1_Static\VS2015 -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -qt-freetype -no-qml-debug -no-angle -nomake tests -nomake examples -skip qtquickcontrols -skip qtquickcontrols2 -skip qtsensors -skip qtdoc -mp

    3.modify qtbase/qmake/Makefile.win32;Add "-DUNICODE -D_USING_V110_SDK71_" to CFLAGS_BARE= ......,after last;
    4.modify qtbase\mkspecs\winrt-x86-msvc2015;

    qmake configuration for winrt-x86-msvc2015

    Written for Microsoft Visual C++ 2015

    MSC_VER = 1900
    MSVC_VER = 14.0
    QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t -D_USING_V110_SDK71


    QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib
    VCPROJ_ARCH = Win32
    WINSDK_VER = 10.0
    WINTARGET_VER = winv10
    WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/
    WINRT_MANIFEST.architecture = x86
,but failed:
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(594): error C2065: “FILE_ID_INFO”: 未声明的标识符
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(594): error C2146: 语法错误: 缺少“;”(在标识符“infoEx”的前面)
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(594): error C2065: “infoEx”: 未声明的标识符
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(597): error C2065: “infoEx”: 未声明的标识符
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(597): error C2065: “FILE_ID_INFO”: 未声明的标识符
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(598): error C2065: “infoEx”: 未声明的标识符
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(598): error C2228: “.VolumeSerialNumber”的左边必须有类/结构/联合
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(598): note: 类型是“unknown-type”
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(601): error C2065: “infoEx”: 未声明的标识符
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(601): error C2228: “.FileId”的左边必须有类/结构/联合
    E:\qt5.9.1source\qtbase\src\corelib\io\qfilesystemengine_win.cpp(601): note: 类型是“unknown-type”
    so, how to compile 5.9.1 for xp, thanks!

  • Hi, it's very time consuming to compile 5.9.1 for WIndows XP, there are many places in the source that needs to be patched or commented out, the error you got is one example, 5.9.1 uses the function GetFileInformationByHandleEx which requires Windows Vista or later, so you need to remove that code from fileIdWin8().

    It might be easier to try to compile Qt 5.6.2 for Windows XP (only Qt WebEngine has problems, see

  • Lifetime Qt Champion


    To add to @hskoglund, the Qt 5.6 series is the last one still supporting Windows XP. So as suggested, stick with that one.

Log in to reply