Skip to content

You know you want to….


Category: Windows

I was very surprised to see how easy it was to design and code in Qt, especially with Qt Creator. In contrast to that, actually building, compiling and installing Qt (4.8.4) in Windows is unnecessarily complex and any instructions or even notes saying that you need to compile it yourself seem to be missing. It doesn’t even come with a compiler, which is weird since the MinGW build download will only compile with an old MinGW 4.4.1.

The installer does provide you with a link to build the debug libraries but nothing for the release libraries. Note that I have also installed CMake and added it to my PATH but am unsure if this is important to the build. Also note that this instruction list relies on you already having installed Qt 4.8.4 for Windows (mingw). Though this is likely to be very similar for other compilers but you’ll definitely need to make substitions for some of the explicit examples below.

  1. So to get this done you’ll first need to install MinGW 4.4.1.
    As I had installed “Codeblocks 10.05 with MinGW” earlier, it included the compiler’s binaries so I didn’t need to download MingW. Again, if you are getting this, for Qt4 it is imperative that you use MinGW version 4.4.1 (Qt5 claims to support the latest MinGWs but I have not tried it out yet)
  2. Make sure the the binaries are in your PATH.
    The PATH environment variable allows you to execute a program that may not be in your current directory in command prompt.
    In my case, I added “C:\Program Files (x86)\Codeblocks\bin\” to my PATH.
    In Windows, you can change environment variables in the System Info window. For Windows 7:

    1. Press the Windows key and Pause/Break. A window will popup.
    2. Near the left hit “Advanced System Settings”.
    3. Navigate to the “Advanced” tab.
    4. Near the bottom click “Environment Variables”. A dialog will popup.
    5. In the lower half of the dialog, look for PATH (in the “System variables” groupbox)
    6. Edit and add the path to your MinGW binaries. (Paths are separated by the ; character)
    7. Save, hit OK and close, etc

    Also make sure that no other paths to MinGW binaries come before it. When looking for an executable, the PATH is searched from first entry to last. For example, if you also have installed the latest MinGW binaries and thus if “C:\MinGW\bin\” comes before “C:\Program Files (x86)\Codeblocks\bin\” (or whatever you are using), those in C:\MinGW\bin\ will be executed, which in this case, will give you problems.

  3. Now the PATH variable will not be updated system wide until you restart your computer.
    If you cannot do that, go back and copy the entire PATH (including your additions) from the above steps.
    Open up a command prompt, type “PATH = ” then paste the PATH you just copied then hit enter.
    To see if it’s working, in any command prompt type “g++ -v”. Check that the version number printed is correct. If it is not, you have the wrong MinGW installed or your PATH order is incorrect. If you get an error saying cannot find the file then your PATH order is definitely incorrect or you somehow did not install all the binaries. If the version number is correct, proceed to the next step.
  4. Open up a command prompt and navigate to wherever you have installed Qt (e.g. C:\Qt\4.8.4 so “cd C:\Qt\4.8.4″). In the command prompt you may also need to type “C:\” (or whatever drive you have Qt installed on) then hit enter if your command prompt is on a different drive. As a hint, this folder should contain “bin” and “doc” directories amongst others. It should also contain an executable called uninst.exe (or just “uninst” if you’ve hidden file extensions).
  5. Save and close any Qt Development applications (QT Creator, codeblocks using QT, MSVC using QT, etc).
  6. Now type “mingw32-make clean”. This will take a while.
  7. Now type configure -debug-and-release. This will start configure with those options. Note, unlike linux systems where ./configure is usually purely a highly configurable script, this configure is interactive. So follow the instructions that it will display.
  8. When it’s done configuring, it should now say something like ‘now ready to be built by mingw32-make’.
  9. Now type “mingw32-make”, hit enter, and go clubbing… because it will take a long time.

Now both your debug and release libraries are built!

If you are using QT Creator, you’ll then need to clean your project and run qmake (all done easily via the QT Creator’s menu bars). As a new user to Qt, I am not entirely certain how it works so the way I did it was to clean while in debug, then run qmake then build and run, followed by doing the same thing for the release. Additionally, I added “CONFIG += build_all” to my .pro file.

That’s all.

I tried to make this as comprehensive as possible but it thus may have overcomplicated things or been made unclear so post comments if you are not sure about anything!

  1. Visit:
  2. Download and install the file that is relevant to you
    e.g. Windows 32/64-bit Installer: opencodecs_0.84.17359.exe 2,46MB

Backup reference url:

It’s really that simple. Forget about Illuminable or CoreFLAC. This simply works. =)

Creative Commons Attribution 3.0 Singapore This work is licensed under a Creative Commons Attribution 3.0 Singapore.