Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtSql Postgress MinGW8 compilation error.



  • 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?


  • Lifetime Qt Champion

    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).


  • Lifetime Qt Champion

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



  • @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,
    

  • Lifetime Qt Champion

    @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)?





  • 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.


  • Lifetime Qt Champion

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



  • @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...


  • Lifetime Qt Champion

    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).



  • @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


  • Lifetime Qt Champion

    @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...


Log in to reply