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. how to add flags to the windres call in your .pro file on windows
Forum Updated to NodeBB v4.3 + New Features

how to add flags to the windres call in your .pro file on windows

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 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.
  • D Offline
    D Offline
    delphi13
    wrote on last edited by delphi13
    #1

    I'm building a Windows 32-bit QT statically linked executable with mingw64 (TDM). If I let qmake do the windres call, it generates the windows resource object file in 64-bit format which then causes the final link to fail. However if I manually call windres first and then run qmake with my .pro file, everything compiles and links correctly. To be clear, these are windows resources (.rc), not QT resrouces (.qrc).

    The fix is simple as I just need to add "-F pe-i386" to the flags on the qmake windres call to generate 32-bit resources, but I can't find any qmake variable to add flags to windres. I expected something like QMAKE_RC_FLAGS to exist.

    I saw QMAKE_RESOURCE_FLAGS, but it's for QT's resources.

    I couldn't find anything in my searches. Any suggestions on how to do it inside the .pro file?

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      if I understand you correctly you are using a 64bit MinGW to cross-compile your application for Win32, right ?

      If so it's probably just the use of the 64bit windres that triggers that by default.

      AFAIK there's currently nothing to add flags or windres. One thing you can try is to modify win32-g++/qmake.conf and add the flag directly to QMAKE_RC.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        if I understand you correctly you are using a 64bit MinGW to cross-compile your application for Win32, right ?

        If so it's probably just the use of the 64bit windres that triggers that by default.

        AFAIK there's currently nothing to add flags or windres. One thing you can try is to modify win32-g++/qmake.conf and add the flag directly to QMAKE_RC.

        D Offline
        D Offline
        delphi13
        wrote on last edited by
        #3

        Thanks, that was unexpectedly obvious once you said it. I already had to modify the qmake.conf to add -m32 flags to QMAKE_CFLAGS & QMAKE_LFLAGS but didn't even think to look for the windres command itself. Tested it and your suggestion worked perfect.

        Thanks for the prompt reply.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          I don't know if there's already something in the mkspecs to cross-compile from 64bit MinGW to 32bit but there's an example in the qmake.conf file from the win32-g++ mkspec that could be of interest.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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