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 distinguish between minGW32 and minGW64
Forum Updated to NodeBB v4.3 + New Features

How to distinguish between minGW32 and minGW64

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 704 Views 2 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.
  • R Offline
    R Offline
    Robert Veigl
    wrote on last edited by
    #1

    Hi all,
    I need a switch in a .pro file to link to different (32 vs 64) bit external libraries.
    Documentation gives examples like:
    win32-g++:contains(QMAKE_HOST.arch, x86_64):{
    message("Host is 64bit")
    ...
    }

    When I switch between MSVC2017 32Bit and MSVC2017 64Bit, I get the correct output (e.g: "Host is 64Bit" when chosen MSVC2017 64Bit)
    However, when I try the same using minGW32 and minGW64, I always get "Host is 32Bit".

    I tried to output both QMAKE_HOST.arch and QMAKE_TARGET.arch, I always get the result: "x86".
    Today I even reinstalled Qt completely, but I cannot find away to distinguish between minGW32 and minGW64.

    I tried several Versions of Qt, at the moment I am on Qt 5.12.6.

    Do I miss a major point, or is that a known / expected behavior?

    Thanks in advance for any help!

    BR, Robert

    aha_1980A R 2 Replies Last reply
    1
    • R Offline
      R Offline
      Robert Veigl
      wrote on last edited by
      #2

      Hi, I just found the ?undocumented? variable 'QT_ARCH' which has the value 'i386' for 32Bit MinGW builds and 'x86_64' for 64Bit MinGW builds.

      I am not sure if this is the correct way to check the architecture for including 3rd party 32 or 64 bit dlls, but for my purpose it is sufficient.

      It would be nice if anyone could confirm that this is the right way.

      Why is this variable undocumented in Qt documentation?

      Thanks,
      Robert

      1 Reply Last reply
      0
      • R Robert Veigl

        Hi all,
        I need a switch in a .pro file to link to different (32 vs 64) bit external libraries.
        Documentation gives examples like:
        win32-g++:contains(QMAKE_HOST.arch, x86_64):{
        message("Host is 64bit")
        ...
        }

        When I switch between MSVC2017 32Bit and MSVC2017 64Bit, I get the correct output (e.g: "Host is 64Bit" when chosen MSVC2017 64Bit)
        However, when I try the same using minGW32 and minGW64, I always get "Host is 32Bit".

        I tried to output both QMAKE_HOST.arch and QMAKE_TARGET.arch, I always get the result: "x86".
        Today I even reinstalled Qt completely, but I cannot find away to distinguish between minGW32 and minGW64.

        I tried several Versions of Qt, at the moment I am on Qt 5.12.6.

        Do I miss a major point, or is that a known / expected behavior?

        Thanks in advance for any help!

        BR, Robert

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Robert-Veigl said in How to distinguish between minGW32 and minGW64:

        QMAKE_HOST.arch

        Try to use QMAKE_TARGET.arch instead. I cannot guarantee it will work for MinGW, though. I use this with MSVC.

        Regards

        Qt has to stay free or it will die.

        1 Reply Last reply
        0
        • R Robert Veigl

          Hi all,
          I need a switch in a .pro file to link to different (32 vs 64) bit external libraries.
          Documentation gives examples like:
          win32-g++:contains(QMAKE_HOST.arch, x86_64):{
          message("Host is 64bit")
          ...
          }

          When I switch between MSVC2017 32Bit and MSVC2017 64Bit, I get the correct output (e.g: "Host is 64Bit" when chosen MSVC2017 64Bit)
          However, when I try the same using minGW32 and minGW64, I always get "Host is 32Bit".

          I tried to output both QMAKE_HOST.arch and QMAKE_TARGET.arch, I always get the result: "x86".
          Today I even reinstalled Qt completely, but I cannot find away to distinguish between minGW32 and minGW64.

          I tried several Versions of Qt, at the moment I am on Qt 5.12.6.

          Do I miss a major point, or is that a known / expected behavior?

          Thanks in advance for any help!

          BR, Robert

          R Offline
          R Offline
          Robert Veigl
          wrote on last edited by
          #4

          Thanks aha_1980, but as I already mentioned in my initial post:

          @Robert-Veigl said in How to distinguish between minGW32 and minGW64:

          When I switch between MSVC2017 32Bit and MSVC2017 64Bit, I get the correct output (e.g: "Host is 64Bit" when chosen MSVC2017 64Bit)
          However, when I try the same using minGW32 and minGW64, I always get "Host is 32Bit".

          I tried to output both QMAKE_HOST.arch and QMAKE_TARGET.arch, I always get the result: "x86".
          Today I even reinstalled Qt completely, but I cannot find away to distinguish between minGW32 and minGW64.

          ...QMAKE_TARGET.arch is what documentation say I should use, but I do not get the desired information.

          BR, Robert

          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