Important: Please read the Qt Code of Conduct -

Error while building Qt 5.7 on Windows

  • I'm trying to build Qt on Windows but when I try to run build I get the following error:

    D:\Dev\Qt\5.6\Src\qtbase/qmake/generators/win32/msvc_vcproj.cpp: In function 'DotNET which_dotnet_version(const QByteArray&)':
    D:\Dev\Qt\5.6\Src\qtbase/qmake/generators/win32/msvc_vcproj.cpp:113:43: error: 'KEY_WOW64_32KEY' was not declared in this scope
    Makefile:248: recipe for target 'msvc_vcproj.o' failed
    mingw32-make: *** [msvc_vcproj.o] Error 1
    Building qmake failed, return code 2

    Both MinGW and the source files are downloaded through the Qt Maintenance Tool. I've tried this on both 5.6 and 5.7 but I get the same error. Is this an issue with the source or the way I'm compiling?

  • Lifetime Qt Champion

    @amura.cxg How did you call configure? It looks like you're trying to build with MS C++ compiler, but you write that you downloaded MinGW.

  • I called configure with the following: configure -debug -nomake examples -opensource -platform win32-g++

    I've been (mostly) following this guide. If you're curious this is what I have in my qt5vars.cmd file:

    @ECHO off
    SET _QT_SRC=D:\Dev\Qt\5.6\Src
    SET _MINGW=D:\Dev\Qt\5.6\mingw49_32
    SET _JOM=D:\Dev\Jom
    REM Add the MinGW bin directory to the path
    SET PATH=%_MINGW%\bin;%PATH%
    REM Add the QT directories to the path
    SET PATH=%_QT_SRC%\qtbase\bin;%_QT_SRC%\gnuwin32\bin;%PATH%
    REM Add the Jom directory to the path
    REM SET QMAKESPEC=win32-msvc2013
    CD %_QT_SRC%
    SET _QT_SRC=
    SET _JOM=

  • So out of curiosity I decided to try running the configure command on version 5.5 and I didn't get any errors. So maybe there are is something up with 5.6 and 5.7 in Windows?

  • Lifetime Qt Champion


    Since you want to build for Visual Studio 2013, why are you setting up your environment to build with MinGW ?

  • Sorry, should have specified. I do want to build with MinGW

  • Lifetime Qt Champion

    Then why are you setting QMAKESPEC to Visual Studio 2013 ?

  • Moderators

    That's a comment in the M$ language (starts with REM) ... :)

  • Lifetime Qt Champion

    @kshegunov I didn't pay attention to that one. Good catch.

  • Moderators


    Did you install mingw with Qt's maintenance tool? If so, then in your start menu you will have a shortcut for the Qt (MinGW) command prompt. Start it and in the root dir just issue configure ... and then mingw32-make .

    There's no jom with mingw, jom is a fix for MS's nmake.

  • This post is deleted!

  • @kshegunov I did indeed, I gave that a try and it worked perfectly. I managed to configure and make with no problems. I really appreciate your help!

    I do have another question regarding cross compiling. Some context first; my ultimate goal is to cross compile Qt for my Raspberry Pi and setup a kit in Qt Creator so I can develop in the creator on my Windows PC and then push the cross compiled code to the Pi. I've been reading through a couple guides (first, second) and in the first guide it says to configure without the -device-option CROSS_COMPILE option to build qmake (Steps 12-14) then to configure and make with the -device-option CROSS_COMPILE option. However the second guide doesn't do this but this second guide is for building on Linux.

    My question is: Do I need to configure without the cross compile option then do it again with it? Or am I safe to just configure and make once with the option?

    Again, I really appreciate the help so far. I'm a bit of a noob and once I get everything working I'm hoping to write up a guide as I found there wasn't one that achieved the same thing I'm trying.

  • Moderators

    I did indeed, I gave that a try and it worked perfectly. I managed to configure and make with no problems.

    I'm glad. The Qt (mingw) command prompt will just call all the needed initialization scripts to set your build environment up.

    My question is: Do I need to configure without the cross compile option then do it again with it? Or am I safe to just configure and make once with the option?

    +1 for the description, but I really can't say. I've never in my life cross-compiled anything, much less Qt. I would guess that you need to cross compile qmake only if you intend on running it on the embedded device, but again, I'm just speculating here.

    Kind regards.

  • Lifetime Qt Champion

    If I may, it would be way easier to do the cross-compiler stuff from a Linux virtual machine. It simplifies things a lot.

  • @SGaist Haha yeah I was starting to feel that was the case. Probably a dumb question, but if I cross compile Qt on Linux will I still be able to develop on my Windows (assuming I have the right cross compiler)? Is the cross compiling step only to get Qt onto my device?

  • Lifetime Qt Champion

    The cross-compiling part is to build the libraries for your device but also to give you a SDK that you can use on your computer to build the application. So technically, you still need to cross-compile Qt from Windows if you want to cross-compile the application there for your target. Otherwise you can also develop on Windows and only fire-up your Linux machine when you want to build/run for your target.

    In any case, Qt Creator is available for both OSs so you won't have too much trouble to develop directly on Linux.

  • @SGaist ok that makes sense, thanks! I'm going to give cross compiling on Windows a couple more tries, I want to see if it's possible mostly because there seems to be a bit of a lack of information around it so if I could help fill that in that would hopefully help someone in the future. Though I suspect I'll be developing in Linux soon haha

    Thanks for all the information, with the help I've got from here I've learned a lot

Log in to reply