Important: Please read the Qt Code of Conduct -

Error occurs while building QtMqtt module

  • Hi all, I am trying to build QtMqtt module on Windows 10 (using VS Dev14 command line developer tool).

    Following the indications found on Google, I have cloned in C:\Qt\5.11.1\Src, and I performed the following commands:

    mkdir build
    pushd build
    qmake -r ..

    Everything goes fine (or I hope so) until qmake -r .., and with nmake the compilation of qmqttclient.cpp, qmqttconnection.cpp, qmqttcontrolpacket.cpp, qmqttmessage.cpp and qmqttsubscription.cpp goes fine too.

    When it's the turn of qmqtttopicfilter.cpp I get two errors, which do not allow me to proceed further:

    C:\Qt\5.11.1\Src\qtmqtt\src\mqtt\qmqtttopicfilter.cpp(207): error C2678: binary '==': no operator found which takes a left-hand operand of type 'QString' (or there is no acceptable conversion)
    C:\Qt\5.11.1\Src\qtmqtt\src\mqtt\qmqtttopicfilter.cpp(225): error C2678: binary '!=': no operator found which takes a left-hand operand of type 'const QStringRef' (or there is no acceptable conversion)

    Please, take into account that I have three different versions of Qt installed (5.7, 5.11.1 and 5.11.2), and I have not excluded incompatibility issues, even though I did not find any.

    changing the lines

    (206)      || d->filter == QLatin1Char('#')
    (207)      || d->filter == QLatin1String("/#"))) {


    (206)      || d->filter == QString('#')
    (207)      || d->filter == QString("/#"))) {

    and the line

    (225)      if (level != QLatin1Char('+') && level !=


    (225)      if (level != QString('+') && level !=

    solves the problem. I do not have tested it yet, anyway.

  • Lifetime Qt Champion


    What exact version of the compiler are you using ?
    What branch are you trying to build ?

    On a side note, you should rathe use out of source builds.

  • @SGaist

    Hi, I am building branch 5.11, and the compiler is exactly the following:

    Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64

    Two further things:

    • The same errors as above are marked even on Qt Creator.
    • I have run the example MQTT Subscriptions Example with the above modifications, and everything goes fine.

  • Lifetime Qt Champion

    I'd suspect an issue with your compiler: QString::operator==(QLatin1String other) has been there for a long time.

Log in to reply