Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved QtSql Postgress MinGW8 compilation error.

    General and Desktop
    qtsql mingw
    3
    11
    295
    Loading More Posts
    • 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.
    • artwaw
      artwaw last edited by

      Good morning,
      I run into a problem building a program on Windows, Qt 5.15.2, MinGW8 x64.

      C:\Qt\Tools\mingw810_64\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\thread:273: error: no match for 'operator==' (operand types are 'std::thread::native_handle_type' {aka 'ptw32_handle_t'} and 'std::thread::native_handle_type' {aka 'ptw32_handle_t'})
      In file included from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/future:39,
                       from C:\Qt\5.15.2\mingw81_64\include\QtCore/qthread.h:51,
                       from C:\Qt\5.15.2\mingw81_64\include\QtCore/QtCore:245,
                       from ..\BalancerStringEditor\dbconnector.h:9,
                       from ..\BalancerStringEditor\dbconnector.cpp:6:
      C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/thread: In function 'bool std::operator==(std::thread::id, std::thread::id)':
      C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/thread:273:26: error: no match for 'operator==' (operand types are 'std::thread::native_handle_type' {aka 'ptw32_handle_t'} and 'std::thread::native_handle_type' {aka 'ptw32_handle_t'})
           return __x._M_thread == __y._M_thread;
                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
      

      I developed program for Mac, where it (after some fun getting Postgres plugin to work) compiles and runs successfully. Decision has been made to port it to Windows, so my .pro file now looks like this:

      QT       += core gui sql
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      CONFIG += c++11
      CONFIG += sdk_no_version_check
      
      (...)
      
      macx:{
          LIBS += -L$$PWD/../libs/pgsql/lib/ -lpq.5
          INCLUDEPATH += $$PWD/../libs/pgsql/include
          DEPENDPATH += $$PWD/../libs/pgsql/include
      }
      
      win32:{
          LIBS += -L$$PWD/../libs/psql-win/lib/ -lpq.5
          INCLUDEPATH += $$PWD/../libs/pgsql-win/include
          DEPENDPATH += $$PWD/../libs/pgsql-win/include
      }
      

      This is the same version Postgres (11) downloaded for different platforms.
      Any ideas?

      For more information please re-read.

      Kind Regards,
      Artur

      jsulm 1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

        What exactly are you trying to achieve? I don't see where the Qt postgresql plugin is involved here nor is dbconnector.h any official Qt source so how should we know what you're doing here?
        I would say you include a header before #include <QtCore/QtCore> (which itself is a bad idea - it includes all QtCore header files for no reason) which messes up the whole stuff. Move it up as first include (and please don't include QtCore/QtCore but only the needed headers).

        Qt has to stay free or it will die.

        artwaw 1 Reply Last reply Reply Quote 1
        • jsulm
          jsulm Lifetime Qt Champion @artwaw last edited by

          @artwaw Where in your code does this error come from?
          Is PostgreSQL lib 32bit or 64bit?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          artwaw 1 Reply Last reply Reply Quote 0
          • artwaw
            artwaw @jsulm last edited by

            @jsulm x64. It comes from the first include of QtSql related class.

            I have a single class that deals with database stuff, DBConnector. In the dump from the compiler you can see the include is at line 9:

            C:\Qt\Tools\mingw810_64\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\thread:273: error: no match for 'operator==' (operand types are 'std::thread::native_handle_type' {aka 'ptw32_handle_t'} and 'std::thread::native_handle_type' {aka 'ptw32_handle_t'})
            In file included from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/future:39,
                             from C:\Qt\5.15.2\mingw81_64\include\QtCore/qthread.h:51,
                             from C:\Qt\5.15.2\mingw81_64\include\QtCore/QtCore:245,
                             from ..\BalancerStringEditor\dbconnector.h:9,
            

            For more information please re-read.

            Kind Regards,
            Artur

            jsulm 1 Reply Last reply Reply Quote 0
            • jsulm
              jsulm Lifetime Qt Champion @artwaw last edited by

              @artwaw I'm not sure MinGW 8.1 is the latest version provided via Qt installer. Can you check and install the latest one (I think it is 8.2)?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              artwaw 1 Reply Last reply Reply Quote 0
              • artwaw
                artwaw @jsulm last edited by

                @jsulm
                820dc397-037c-47e7-ae84-c2632b8c24a1-image.png

                For more information please re-read.

                Kind Regards,
                Artur

                1 Reply Last reply Reply Quote 0
                • artwaw
                  artwaw last edited by

                  Google search for the error shows quite a few unresolved issues like mine scattered over the web (SO and other places) which doesn't make me feel optimistic.

                  In the meantime I redownloaded Postgres libraries (from version 11 there is no x86 version, only x64) but the problem, no surprise here, remains.

                  For more information please re-read.

                  Kind Regards,
                  Artur

                  jsulm 1 Reply Last reply Reply Quote 0
                  • jsulm
                    jsulm Lifetime Qt Champion @artwaw last edited by

                    @artwaw Did you check Qt bug tracker? Maybe already reported.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    artwaw 1 Reply Last reply Reply Quote 1
                    • artwaw
                      artwaw @jsulm last edited by

                      @jsulm I did, looks like it is not reported.

                      I wonder if I should report it, considering we are not getting any bug fixes for 5.15 anyway or just wait for 6.02, switch and see if it is still broken... Anyway, looks like I either have to find workaround (I don't think I have skills to do that considering that I don't know what to do) or convince parties involved that this tool of mine will not work on Windows. Crap...

                      For more information please re-read.

                      Kind Regards,
                      Artur

                      1 Reply Last reply Reply Quote 0
                      • Christian Ehrlicher
                        Christian Ehrlicher Lifetime Qt Champion last edited by

                        What exactly are you trying to achieve? I don't see where the Qt postgresql plugin is involved here nor is dbconnector.h any official Qt source so how should we know what you're doing here?
                        I would say you include a header before #include <QtCore/QtCore> (which itself is a bad idea - it includes all QtCore header files for no reason) which messes up the whole stuff. Move it up as first include (and please don't include QtCore/QtCore but only the needed headers).

                        Qt has to stay free or it will die.

                        artwaw 1 Reply Last reply Reply Quote 1
                        • artwaw
                          artwaw @Christian Ehrlicher last edited by

                          @Christian-Ehrlicher That is new.
                          I always use QtCore to avoid the plethora of single class includes. Same with QtWidgets or QtGui. Apparently that doesn't work properly when working with external includes. It also sheds a bit of light on my other problems in the past... I simply was not aware.

                          Anyway, now all works properly.

                          I just assumed that it is Postgres messing up, as this is the only new thing in the workflow that worked for me till now.

                          Lesson learned, thank you @Christian-Ehrlicher

                          For more information please re-read.

                          Kind Regards,
                          Artur

                          1 Reply Last reply Reply Quote 0
                          • Christian Ehrlicher
                            Christian Ehrlicher Lifetime Qt Champion last edited by Christian Ehrlicher

                            @artwaw said in QtSql Postgress MinGW8 compilation error.:

                            I always use QtCore to avoid the plethora of single class includes.

                            Looks like you have enough time...

                            Qt has to stay free or it will die.

                            1 Reply Last reply Reply Quote 2
                            • First post
                              Last post