Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't use RC file
Forum Updated to NodeBB v4.3 + New Features

Can't use RC file

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 5 Posters 7.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Roy44R Offline
    Roy44R Offline
    Roy44
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      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"
      ...
      ...
      
      1 Reply Last reply
      3
      • Roy44R Offline
        Roy44R Offline
        Roy44
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          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!

          1 Reply Last reply
          5
          • Roy44R Offline
            Roy44R Offline
            Roy44
            wrote on last edited by
            #5

            Thanks it works now.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mdnchauhan
              wrote on last edited by
              #6

              Hi, thanks for this discussion.
              After implementing as per suggested by Roy44 and Hskoglund, I am able to see version info of my exe in File->property->Details.

              I have following questions:

              • It is showing FileVersion as 0.0.0.0. What do I need to do for displaying my desired FileVersion there?
              • What do we need to do for Linux and MAC. As here we are including "windows.h", that may not work while compiling code on these OS.

              Thanks.

              T 1 Reply Last reply
              0
              • M Offline
                M Offline
                mchinand
                wrote on last edited by
                #7

                Use the VERSION variable in your project file.

                1 Reply Last reply
                2
                • M mdnchauhan

                  Hi, thanks for this discussion.
                  After implementing as per suggested by Roy44 and Hskoglund, I am able to see version info of my exe in File->property->Details.

                  I have following questions:

                  • It is showing FileVersion as 0.0.0.0. What do I need to do for displaying my desired FileVersion there?
                  • What do we need to do for Linux and MAC. As here we are including "windows.h", that may not work while compiling code on these OS.

                  Thanks.

                  T Offline
                  T Offline
                  Tyras
                  wrote on last edited by Tyras
                  #8

                  @mdnchauhan said in Can't use RC file:

                  • What do we need to do for Linux and MAC. As here we are including "windows.h", that may not work while compiling code on these OS.

                  RC files are a Windows thing. OSX and Linux use different approaches. So you don't need to concern about the #include <windows.h> in the RC file since they won't use it.

                  OSX (Mac) uses a "Info.plist" file, that is a xml describing the application info in the following format:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                  <plist version="1.6">
                  <dict>
                  	<key>NSPrincipalClass</key>
                  	<string>NSApplication</string>
                  	<key>CFBundleIconFile</key>
                  	<string>@ICON@</string>
                  	<key>CFBundlePackageType</key>
                  	<string>APPL</string>
                  	<key>CFBundleGetInfoString</key>
                  	<string>//Version goes here. something like 1.0.0//</string>
                  	<key>CFBundleSignature</key>
                  	<string>@TYPEINFO@</string>
                  	<key>CFBundleExecutable</key>
                  	<string>@EXECUTABLE@</string>
                  	<key>CFBundleIdentifier</key>
                  	<string>@BUNDLEIDENTIFIER@</string>
                  	<key>NOTE</key>
                  	<string>//Some text you want to put here. something short like "Business® All rights reserved"//</string>
                  	<key>CFBundleShortVersionString</key>
                  	<string>//Bundle version. Usually the same thing as CFBundlePackageType//</string>
                  	<key>CFBundleVersion</key>
                  	<string>//same thing as above//</string>
                  </dict>
                  </plist>
                  

                  Also you need to specify the path to the Info.plist in your .pro file:

                  QMAKE_INFO_PLIST = /path/to/your/Info.plist
                  

                  My suggestion is to put it in the root of your project directory and use

                  QMAKE_INFO_PLIST = $$_PRO_FILE_PWD_/Info.plist
                  

                  To set the application icon, just add to your .pro file:

                  ICON = /path/to/icon.icns 
                  

                  I don't know how it works in Linux, though.

                  When a coder says that it's impossible to do something, he's actually feeling too lazy to do it.

                  1 Reply Last reply
                  1

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved