Coding with Titans

so breaking things happens constantly, but never on purpose

Configure Qt 4.8.6 in QtCreator 4.5+

Latest version of QtCreator out of the box installs only Qt 5.0+. That’s rather obvious, but what if someone wants to play a bit with previous edition? Yeap v4.8, the one that is almost 4 years old! It is still doable and I will shortly show the way. Move to TL;DR if you are not interested in the background story.

You could ask why I wanted to do that in the first place, so here is the reason. I am still using a BlackBerry smartphone with BB10 OS onboard. And it’s much easier to develop (and test) a “meaty part” for a native app using the desktop edition of Qt in QtCreator and then only bind it with the UI using Momentics IDE than write everything there and deploy all the time on the device. This is much slower and tiring process, especially when the BB10 device emulator doesn’t work on Windows 10 with Hyper-V enabled…

Let me stop you here, before you start complaining about it. Although the BB10 platform itself is dead and abandoned, the same code can be used to develop Android apps (and of course UWP etc…), so not everything seems to be the waste of time. Download the NDK using Android Studio, use the MaintenanceTool.exe (from Qt installation folder) to add required architecture crosscompilers support and configure the paths, kits and deployment targets in QtCreator with this short guide.

Really, after all you will be much happier person, that Qt is the framework that binds all platforms together.

TL;DR

So how to add Qt 4.8.6 support?

  1. First and foremost – Qt installation is required! You can obtain the free version for open-source projects from here. Select the options that suits best and simply install it. I used “C:\Qt” as destination path.

  2. From Qt archives download the Qt 4.8.6 installer. I am not going to install VS2008 nor VS2010 on my machines anymore, so I went for MinGW-based version. I recommend using “C:\Qt\4.8.6” as the destination path, as it will be next to 5.10.0 version and will also simplify further configuration.

  3. Matching MinGW compiler can be downloaded from here (ended at location: “C:\mingw32”)

  4. Launch QtCreator and open “Tools –> Options”. Now we need to define locations for all the compilers, debuggers etc.

  5. Add new Qt Version. Use the ‘Add…’ button on the right and navigate for qmake.exe in 4.8.6 installation folder. Qt 4.8.6 qmake

  6. On “Compilers” tab add new MinGW C compiler (gcc.exe). C Compiler

  7. Then add MinGW C++ compiler (g++.exe). Cpp Compiler

  8. On “Debuggers” tab add appropriate GDB from MinGW folder. GDB

  9. Finally on “Kits” tab bind all the tools added in steps above. MinGW Qt 4.8.6 kit

  10. Voilà. Now the newly created kit can be using to build future projects.

Supplement

It might happen, that the application won’t start. It’s mostly because there are some DLLs the output executable depends on (like: QtCore4.dll, QtNetwork4.dll, libgcc_s_dw2-1.dll, libstdc++-6.dll, libwinpthread-1.dll or their debug editions). The easiest way is to copy them from Qt 4.8.6 installation directory into the debug-build folder (i.e.: <project>/../build-<kit>-<platform>/debug) manually, setup it up as a post-build step or make the DLLs generally visible by adding Qt 4.8.6/bin folder into PATH environment variable.