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. [SOLVED] How to make windres understand empty spaces in macro definitions
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to make windres understand empty spaces in macro definitions

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.9k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    napajejenunedk0
    wrote on 8 Oct 2012, 12:36 last edited by
    #1

    Using Windows, I have a .rc file that uses macro definitions. One of those definitions is defined as:

    .pro
    @
    defineReplace(quoteMacroValue) {
    QUOTED_VAL =
    !isEmpty(ARGS) {
    QUOTED_VAL = "$$quote($$ARGS)"
    }

    return ($$QUOTED_VAL)
    }

    LEGAL_TRADEMARKS = All Rights Reserved
    DEFINES*=LEGAL_TRADEMARKS_RC=$$quoteMacroValue($$LEGAL_TRADEMARKS)
    @

    .rc
    @
    #define MAKESTRING(x) #x
    #define EXPAND_MACRO_ARGS_COUNT_1(a) MAKESTRING(a)

    ...

    BEGIN
    BLOCK "StringFileInfo"
    BEGIN
    BLOCK "040904E4"
    BEGIN

            ...
            
            VALUE "LegalTrademarks",    EXPAND_MACRO_ARGS_COUNT_1(WINDOWS_RC_FILE_LEGAL_TRADEMARKS)
    
            ...
    
        END
    END
    
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
    

    END
    @

    When building using MSVC it uses rc resource compiler and it handles the code perfectly well and All Rights Reserved is interpreted as single string when declared as a value for the preprocessor definition LEGAL_TRADEMARKS_RC.

    However gcc calls windres and it doesn't couple up the words All, Rights and Reserved into a single string (the actual value of the preprocessor definition), but uses the first one only I think - All and thinks that the rest two - Rights and Reserved are some command-line options to itself (windres).

    Probably I should play with the quotes in the:
    @
    QUOTED_VAL = "$$quote($$ARGS)"
    @

    line?

    How could I specify the macro value, so that the empty spaces are treated as part of the macro's value?

    1 Reply Last reply
    0
    • N Offline
      N Offline
      napajejenunedk0
      wrote on 8 Oct 2012, 15:04 last edited by
      #2

      I found the solution. Instead of:

      @
      "$$quote($$ARGS)"
      @

      use:
      @
      $$join(ARGS, \x20)
      @

      1 Reply Last reply
      0

      1/2

      8 Oct 2012, 12:36

      • Login

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