1
votes

In order to deploy my project in Windows, I have got the Qt project from Linux and paste all the source files one paste on Windows 7 VM VirtualBox and tried to build it there.

Unfortunately, I am having the following error that I can't find a way to fix. The Qt Creator compiles well the example projects that come with it, but with my project, it pops that errors on MinGW thread header. enter image description here

    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.1\mingw81_64\include/QtCore/qthread.h:51,
                     from C:\Qt\5.15.1\mingw81_64\include/QtCore/QtCore:245,
                     from C:\Qt\5.15.1\mingw81_64\include/QtWidgets/QtWidgetsDepends:3,
                     from C:\Qt\5.15.1\mingw81_64\include\QtWidgets/QtWidgets:3,
                     from ..\RaqMed/patientlineedit.h:54,
                     from ..\RaqMed\addappointmentform.h:13,
                     from ..\RaqMed\calendar.cpp:4:
    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;
                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

My .pro file:

QT       += core gui
QMAKE_CXXFLAGS  += -IC:\Users\BRUDEL\Desktop\postgresql\include -fpermissive
QMAKE_LFLAGS    += -LC:\Users\BRUDEL\Desktop\postgresql\lib -llibpq

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = RaqMed
TEMPLATE = app

CONFIG += c++11

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    addappointmentform.cpp \
    addpatientform.cpp \
    appointmentwidget.cpp \
    bstring.cpp \
    calendar.cpp \
    edittabmodel.cpp \
    main.cpp \
    patient.cpp \
    patientbdmodel.cpp \
    patientdelegate.cpp \
    patientlineedit.cpp \
    qutils.cpp

HEADERS += \
    addappointmentform.h \
    addpatientform.h \
    appointmentwidget.h \
    bstring.h \
    calendar.h \
    edittabmodel.h \
    patient.h \
    patientbdmodel.h \
    patientdelegate.h \
    patientlineedit.h \
    qutils.h

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
    teste.qrc

FORMS += \
    calendar.ui \
    testes.ui

DISTFILES += \
    capa.png \
    icon0.png \
    icon2.png

I have installed only the following modules of Qt Creator

Qt 5.15.1

MinGW 8.1.0 64-bit
Qt Charts
Qt Debug Information Files

Developer and Designer Tools

Qt Creator 4.13.1 CDB Debugger Support
Debugging Tools for Windows
MinGW 8.1.0 64-bit
Qt Installer Framework 3.2
CMake 3.17.1 64-bit Ninja 1.10.0

I have found this similar question with no answer "No match for operator" when including QtSql library in QT

I'm also having these messages when opening Qt Creator

enter image description here

Thanks, and sorry for any posting error, I'm not habituated in English writing.

Edit I already solved the plugin errors by setting the environment variable QT_OPENGL to 'opengl', but the compile error still remain

Edit 2 I copy the thread header file and comment the problem functions, now it's working :)

1

1 Answers

0
votes

The problem is exactly in what compiler says:

return __x._M_thread == __y._M_thread;

It doesn't know how to compare objects because operator==() wasn't implemented.

Generally speaking you have two options:

  • Implement operator== with operator overloading
  • Find another solution that doesn't involve comparison like this