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.



Add version information to your executables and libraries in Qt

Executable files have an embedded version information which can be found by checking their properties. It includes version number, comments, company info etc. As developer you sometimes need to leave a scratch on the EXE files you are providing to your customers in order to track what you have and what your customers have.

Continue reading “Add version information to your executables and libraries in Qt”