Update QT under Windows

Well, another lesson in How To Complicate Things ™. Could be as easy as pacman -Syu, run qmake and recompile all, but far from it 🙁

  1. Run MaintenanceTool.exe. Of course it has no entry in the start menu, why should it. But it’s easy to find: C:\Qt\MaintenanceTool.exe
  2. Skip the first page, you don’t need an account. God, how I hate this shit!
  3. On the next page, select “Add or remove components”. “Update components” will only update your *current* version. To install a *new* version, you have select the first option.
  4. Wait…
  5. Select the version you want to install and wait, but take a look while it’s installing. Ignore the errors, it’ll work anyway

Once the installer finished with errors, open QtCreator and load your project. Now you have to manage your “Kit”. Select “Project” on the left sidebar, “Build & Run” on top and then click “Manage kits…”

  • Click “Add” and select the new version for “Debugger” and “Qt version”
  • Give it a “Name:”. Best to copy the string from the Auto-detected version
  • Apply
  • Now change the Kit of your project to the new one. The thingy above “Build|Run” right beside “Manage Kits…” is a drop down box, even if it doesn’t look like it
  • Change the build directory accordingly
  • Clear the environment by selecting “Build” instead of “Run”. Then expand “Build Environment” at the bottom and check “Clear system environment”
  • Select “Run” and set “Base environment for this configuration” to “Build environment”

If you don’t need SQL-Plugins, clean all, run qmake and compile. If you need access to, say, a Postgres-DB, the fun doesn’t end yet. To connect to the database, you have to add the directory with libpq.dll to the PATH. Yes, to the PATH environment variable! WTF? For now that would be “C:\psql\9.5\bin”.

If you create a new project, don’t forget to add

QT       += sql
LIBS     += "C:\psql\9.5\lib\libpq.lib"

to you .pro-file.

If you build a release, don’t forget to copy the dll-files to the release directory. For a QT-Gui application those would be at least:

  • libeay32.dll
  • libecpg.dll
  • libecpg_compat.dll
  • libgcc_s_dw2-1.dll
  • libiconv-2.dll
  • libintl-8.dll
  • libpgtypes.dll
  • libpq.dll
  • libstdc++-6.dll
  • libwinpthread-1.dll
  • libxml2.dll
  • libxslt.dll
  • Qt5Core.dll
  • Qt5Gui.dll
  • Qt5Sql.dll
  • Qt5Widgets.dll
  • ssleay32.dll
  • zlib1.dll

Well, I hope I didn’t forget anything. See you next time!