Adding External Libraries to Qt Projects

As simple as it sounds, most of the time it’s a hassle to add the required libraries to your Qt projects. You have to add the include path, the libraries and if you are aiming to have a cross-platform project, you need to account for Windows, macOS and Linux operating systems separately. Well, there are a couple a methods to simplify this a bit which I’ll describe in this tutorial.



Continue reading “Adding External Libraries to Qt Projects”

How to Get Current App Version in Qt

I have tried numerous methods to get an application’s own version number and believe me this is the best way to get it. First of all if we consider the fact that setting a Qt application version is done in PRO file (qmake) using the following simple command:

VERSION = 1.2.3.4

Then getting this same value should be the easiest possible method.

Just add the following line to your PRO file after defining version as seen above and you can use the same version string wherever you like in the code:

DEFINES += APP_VERSION=\\\"$$VERSION\\\"

APP_VERSION will contain the string “1.2.3.4” and can be used in the C++ code.