[Qt-interest] embeding version number

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Mar 3 16:56:23 CET 2010


Jaime Fernandez wrote on Wednesday, March 03, 2010 2:14 PM:

> void QCoreApplication::setApplicationVersion( const QString& version )

I doubt very much that this will set the DLL/*.exe version resource on Windows, the one you see when you right-click on a DLL/*.exe -> Properties -> Version. This information can then be evaluated when UPDATING an installation (with an MSI based installer, for example). But an installer cannot possibly know what meaning some random variable - which happens to be called "version" - in your application data segment has ;)

This version info is set in the corresponding *.rc resource file and compiled into the executable into a well-specified place in the binary, with the MS resource compiler (RC - http://msdn.microsoft.com/en-us/library/aa381042%28VS.85%29.aspx):

For example:


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 0,1,0,1
 PRODUCTVERSION 0,1,0,1
 ...
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "080904b0"
        BEGIN
            VALUE "CompanyName", "FooBiz\0"
            VALUE "FileDescription", "FooApp\0"
            VALUE "FileVersion", "0, 1, 0, 1\0"
            ...
        END
    END
   ...
END


I think initially I wrote that qmake could also process Microsoft *.rc files (by calling rc.exe for you), but I think I confused them with *.rcc Qt resource files!

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list