Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61740

MinGW compilation fails with _WIN32_IE set below 0x0700

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.9.2
    • 5.8.0, 5.9.0, 5.9.1
    • Extras: Win
    • None
    • fe63ea126822fae40db90a06ab3be47700e85ec4 (qtwinextras/5.9, 3.7.2017, 5.9.2)

    Description

      When cross-compiling Qt 5.9.1 with MinGW 6.3.0 (as packaged by Debian Stretch), I get a warning

      qwinjumplist.cpp:44:66: warning: integer overflow in preprocessor expression
       # if defined(_WIN32_IE) && _WIN32_IE << 0x0700 // _WIN32_IE_IE70
      

      and later an error

      qwinjumplist.cpp: In static member function ‘static IShellItem2* QWinJumpListPrivate::toIShellItem(const QWinJumpListItem*)’:
      qwinjumplist.cpp:400:106: error: ‘SHCreateItemFromParsingName’ was not declared in this scope
           SHCreateItemFromParsingName(buffer.data(), 0, qIID_IShellItem2, reinterpret_cast<void **>(&shellitem));
                                                                                                                ^
      

      I suspect that the macro, the one from the warning above, has a bug – the original author probably meant to write _WIN32_IE < 0x0700 instead of _WIN32_IE << 0x0700.

      Here is the relevant code portion from Qt sources

      qwinjumplist.cpp
      #ifdef Q_CC_MINGW // MinGW: Enable SHCreateItemFromParsingName()
      #  if defined(_WIN32_IE) && _WIN32_IE << 0x0700 // _WIN32_IE_IE70
      #     undef _WIN32_IE
      #  endif
      #  ifndef _WIN32_IE
      #    define _WIN32_IE 0x0700
      #  endif
      #endif // Q_CC_MINGW
      

      My MinGW defines -DWINVER=0x600 -D_WIN32_WINNT=0x0600, which I assume indirectly triggers definition of _WIN32_IE 0x600 somewhere in Windows headers. In the macro above, WIN32_IE << 0x0700 is turned into 0x600 << 0x0700 which evaluates to false, so _WIN32_IE is never re-defined to be 0x0700, and SHCreateItemFromParsingName() is not made visible in Windows headers if _WIN32_IE < 0x0700 (Windows Vista API version), thus the compilation fails not being able to find SHCreateItemFromParsingName.

      This bug was introduced in commit decbd7c63334e97ace549ffcb7d2f6fe5eeb5640 by Friedemann Kleint while fixing QTBUG-51673 over a year ago.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            nurupo nurupo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes