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. Get compiler
Qt 6.11 is out! See what's new in the release blog

Get compiler

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 555 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.
  • P Offline
    P Offline
    pixbyte
    wrote on last edited by pixbyte
    #1

    As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.
    But is it also possible to get a similar value for MingW?
    I need to split this define to use also if Mingw is used. Else it will use the default pragma pack that gives me issues with structures.
    //#ifdef _MSC_VER || _MINGW_VER
    #pragma pack(push, 1)
    //#endif

    sierdzioS 1 Reply Last reply
    0
    • P pixbyte

      As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.
      But is it also possible to get a similar value for MingW?
      I need to split this define to use also if Mingw is used. Else it will use the default pragma pack that gives me issues with structures.
      //#ifdef _MSC_VER || _MINGW_VER
      #pragma pack(push, 1)
      //#endif

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @pixbyte said in Get compiler:

      As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.

      Yes you are.

      But is it also possible to get a similar value for MingW?

      Sure, check _GLIBCXX_RELEASE for example. But probably it's better to use Qt's defines because they are guaranteed to work:

      • Q_CC_GNU
      • Q_CC_MSVC

      https://doc.qt.io/qt-5/qtglobal.html#Q_CC_GNU

      (Z(:^

      P 1 Reply Last reply
      1
      • sierdzioS sierdzio

        @pixbyte said in Get compiler:

        As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.

        Yes you are.

        But is it also possible to get a similar value for MingW?

        Sure, check _GLIBCXX_RELEASE for example. But probably it's better to use Qt's defines because they are guaranteed to work:

        • Q_CC_GNU
        • Q_CC_MSVC

        https://doc.qt.io/qt-5/qtglobal.html#Q_CC_GNU

        P Offline
        P Offline
        pixbyte
        wrote on last edited by
        #3

        @sierdzio
        But Q_CC_GNU means this is set on all QT platforms also with Linux and macOS. But I want to use there
        the common packing, just on Windows I need to tell the compiler that the DLL was compiled with pragma pack(push,1) for MSC_VER and MingW.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @pixbyte said in Get compiler:

          @sierdzio
          But Q_CC_GNU means this is set on all QT platforms also with Linux and macOS

          Then check also for Q_OS_WIN

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          2

          • Login

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