-2

So I was developing my C++ application when a came across windows resource files (.rc), my application is in portuguese of portugal so I wrote my file like this:

MAIN ICON "icon.ico"
MAIN VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "081604b0"
        BEGIN
            VALUE "Comments", "Tenta a tua Sorte!"
            VALUE "CompanyName", "Adsglobal"
            VALUE "FileDescription", "Jogo Simples"
            VALUE "FileVersion", "1.0.0.0"
            VALUE "InternalName", "Tenta a Sorte"
            VALUE "LegalCopyright", "Copyright © Rodrigo Santos 2020"
            VALUE "OriginalName", "Tenta a Sorte"
            VALUE "ProductName", "Tenta a Sorte"
            VALUE "ProductVersion", "1.0.0.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0816, 1200
    END
END

For some reason that I don't know when I compile it with g++ and windres, I get the icon but the version info isn't displayed.
If you can help me please awnser this

  • 1
    What exactly do you mean by 'isn't not'? Do you mean it *is* displayed and shouldn't be? Because that's what it says. Please clarify. – user207421 Aug 21 '20 at 00:41

1 Answers1

2

You are specifying the wrong ID for the VERSIONINFO resource. Per the VERSIONINFO documentation, the ID must be 1, not MAIN:

There are two ways to format a VERSIONINFO statement:

versionID VERSIONINFO fixed-info  { block-statement . . . }

- or -

versionID VERSIONINFO 
fixed-info
BEGIN
block-statement
...
END

Parameters

versionID

Version-information resource identifier. This value must be 1.

...

So, try this instead:

MAIN ICON "icon.ico"
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "081604b0"
        BEGIN
            VALUE "Comments", "Tenta a tua Sorte!"
            VALUE "CompanyName", "Adsglobal"
            VALUE "FileDescription", "Jogo Simples"
            VALUE "FileVersion", "1.0.0.0"
            VALUE "InternalName", "Tenta a Sorte"
            VALUE "LegalCopyright", "Copyright © Rodrigo Santos 2020"
            VALUE "OriginalName", "Tenta a Sorte"
            VALUE "ProductName", "Tenta a Sorte"
            VALUE "ProductVersion", "1.0.0.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0816, 1200
    END
END

Alternatively, you can use the VS_VERSION_INFO macro, which is pre-defined in <winver.h>, eg:

#include <winver.h>

MAIN ICON "icon.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "081604b0"
        BEGIN
            VALUE "Comments", "Tenta a tua Sorte!"
            VALUE "CompanyName", "Adsglobal"
            VALUE "FileDescription", "Jogo Simples"
            VALUE "FileVersion", "1.0.0.0"
            VALUE "InternalName", "Tenta a Sorte"
            VALUE "LegalCopyright", "Copyright © Rodrigo Santos 2020"
            VALUE "OriginalName", "Tenta a Sorte"
            VALUE "ProductName", "Tenta a Sorte"
            VALUE "ProductVersion", "1.0.0.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0816, 1200
    END
END
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770