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

Qt does not compile with MinGW using w32api.h version 3.12.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 4.6.0
    • 4.4.1
    • Build tools: qmake
    • None
    • 32507afe1125abf122435946dcd58a9d0d5d6ff1

      Qt does not compile with MinGW using w32api.h version 3.12.

      The error could be:
      /opt/cross/4.4.3/include/QtCore/../../src/corelib/arch/qatomic_windows.h:371: Fehler: Deklaration der C-Funktion »long int InterlockedCompareExchange(long int*, long int, long int)« steht in Konflikt mit
      /opt/cross/mingw345/usr/local/include/winbase.h:1663: Fehler: vorherige Deklaration »long int InterlockedCompareExchange(volatile long int*, long int, long int)«

      or

      /opt/cross/4.4.3/include/QtCore/../../src/corelib/arch/qatomic_windows.h:371: Fehler: Deklaration der C-Funktion »long int InterlockedCompareExchange(long int*, long int, long int)« steht in Konflikt mit
      /opt/cross/mingw345/usr/local/include/winbase.h:1663: Fehler: vorherige Deklaration »LONG InterlockedCompareExchange(volatile LONG*, LONG, LONG)«

      A possible fix is:

      diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h
      index fa147ff..8eaac40 100644
      — a/src/corelib/arch/qatomic_windows.h
      +++ b/src/corelib/arch/qatomic_windows.h
      @@ -376,7 +376,11 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo
      #else

      extern "C" {
      +#if defined(Q_CC_MINGW) && __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION > 12
      __declspec(dllimport) long __stdcall InterlockedCompareExchange(long *, long, long);
      +#else
      + __declspec(dllimport) long __stdcall InterlockedCompareExchange(volatile long *, long, long);
      +#endif
      __declspec(dllimport) long __stdcall InterlockedIncrement(long *);
      __declspec(dllimport) long __stdcall InterlockedDecrement(long *);
      __declspec(dllimport) long __stdcall InterlockedExchange(long *, long);

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

            fenglich Frans Englich (closed Nokia identity)
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes