Can't use RC file



  • Hi
    I would like to display information in detail in my executablelike company name version etc.
    so I made this rc file:

    #ifndef RCFILE_H
    #define RCFILE_H
    #include "../svn_version.rc"
    
    IDI_ICON1               ICON    DISCARDABLE     "../res/mediasofts.ico"
    #define VER_FILEVERSION             1,0,0,0
    #define VER_FILEVERSION_STR         "1.0.0.0\0"
    
    #define VER_PRODUCTVERSION          1,0,0,I_SVNREVINT
    #define VER_PRODUCTVERSION_STR      "1.0\0"
    
    #define VER_COMPANYNAME_STR         "Médiasofts"
    #define VER_FILEDESCRIPTION_STR     "Mediacad drawing software"
    #define VER_INTERNALNAME_STR        "Médiacad"
    #define VER_LEGALCOPYRIGHT_STR      "Copyright © 2016 Médiasofts"
    #define VER_LEGALTRADEMARKS1_STR    "All Rights Reserved"
    #define VER_LEGALTRADEMARKS2_STR    VER_LEGALTRADEMARKS1_STR
    #define VER_ORIGINALFILENAME_STR    "Mediacad.exe"
    #define VER_PRODUCTNAME_STR         "Mediacad"
    
    #define VER_COMPANYDOMAIN_STR       "http://mediasofts.fr/"
    
    BEGIN
        BLOCK "StringFileInfo"
        BEGIN
            BLOCK "040904E4"
            BEGIN
                VALUE "CompanyName",        VER_COMPANYNAME_STR
                VALUE "FileDescription",    VER_FILEDESCRIPTION_STR
                VALUE "FileVersion",        VER_FILEVERSION_STR
                VALUE "InternalName",       VER_INTERNALNAME_STR
                VALUE "LegalCopyright",     VER_LEGALCOPYRIGHT_STR
                VALUE "LegalTrademarks1",   VER_LEGALTRADEMARKS1_STR
                VALUE "LegalTrademarks2",   VER_LEGALTRADEMARKS2_STR
                VALUE "OriginalFilename",   VER_ORIGINALFILENAME_STR
                VALUE "ProductName",        VER_PRODUCTNAME_STR
                VALUE "ProductVersion",     VER_PRODUCTVERSION_STR
                VALUE "Rev",     I_SVNREV
                VALUE "Date",     I_SVN_CLOCKDATE
            END
        END
    
        BLOCK "VarFileInfo"
        BEGIN
            VALUE "Translation", 0x409, 1252
        END
    END
    #endif // RCFILE_H
    

    I have

    RC_FILE = mediacad.rc
    

    in my .pro but the compilation failed on RC with :
    ....\MediaCad\mediacad.rc(24) : error RC2135 : file not found: StringFileInfo
    ....\MediaCad\mediacad.rc(26) : error RC2135 : file not found: 040904E4
    ....\MediaCad\mediacad.rc(28) : error RC2135 : file not found: CompanyName
    ....\MediaCad\mediacad.rc(29) : error RC2135 : file not found: VALUE

    I don't know why it failed .
    Do you have an idea ?
    Is it possible to use RC file for DLL too ?



  • Hi, you forgot the version info title line, try change to this:

    ...
    ...
    #define VER_PRODUCTNAME_STR         "Mediacad"
    
    #define VER_COMPANYDOMAIN_STR       "http://mediasofts.fr/"
    
    VS_VERSION_INFO VERSIONINFO
    BEGIN
        BLOCK "StringFileInfo"
    ...
    ...
    


  • Thanks, errors are gone but if I look the details of my executable
    (properties > details on windows) I did not found my information.



  • Hi, actually if you binary dump your .exe file you'll see your version info, but agreed it's nice to be able to see it in Explorer (properties->details).

    So, at the top of your .RC file add a Language statement to make the version info visible. (Need windows.h for LANG_ENGLISH etc, I think you can replace those with hex numbers if you don't like to include windows.h):

    #ifndef RCFILE_H
    #define RCFILE_H
    
    #include <windows.h>
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    
    #include "../svn_version.rc"
    
    IDI_ICON1               ICON    DISCARDABLE     "../res/mediasofts.ico"
    #define VER_FILEVERSION             1,0,0,0
    ...
    

    Also to cover all the bases/fields in that properties->details dialog box, you can get fancy and add the Fileversion and Productversion lines:

    ...
    #define VER_COMPANYDOMAIN_STR       "http://mediasofts.fr/"
    
    VS_VERSION_INFO VERSIONINFO
    FILEVERSION VER_FILEVERSION
    PRODUCTVERSION VER_PRODUCTVERSION
    BEGIN
        BLOCK "StringFileInfo"
    ...
    

    Hope this helps!



  • Thanks it works now.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.