Important: Please read the Qt Code of Conduct -

Building QtMqtt in ubuntu

  • Hello,
    git clone
    cd qtmqtt
    mkdir build
    cd build
    sudo make

    and i changed this line
    //connect(socket, &QAbstractSocket::errorOccurred, this, &QMqttConnection::transportError);
    by this one:
    connect(socket, QOverloadQAbstractSocket::SocketError::of(&QAbstractSocket::error), this, &QMqttConnection::transportError);
    when want to compile the module qtmqtt, but i have this error:

    /home/michel/mqtt/qtmqtt/src/mqtt/qmqtttopicname.cpp:148:48: error: ‘KeepEmptyParts’ is not a member of ‘Qt’
    148 | return d->name.split(QLatin1Char('/'), Qt::KeepEmptyParts);
    | ^~~~~~~~~~~~~~
    /home/michel/mqtt/qtmqtt/src/mqtt/qmqtttopicname.cpp: In function ‘size_t qHash(const QMqttTopicName&, size_t)’:
    /home/michel/mqtt/qtmqtt/src/mqtt/qmqtttopicname.cpp:189:36: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
    189 | return qHash(name.d->name, seed);
    | ^
    In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:47,
    from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:49,
    from /usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractanimation.h:43,
    from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:6,
    from ../../include/QtMqtt/QtMqttDepends:3:
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qhashfunctions.h:99:41: note: candidate 1: ‘uint qHash(const QString&, uint)’
    99 | Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QString &key, uint seed = 0) Q_DECL_NOTHROW;
    | ^~~~~
    /home/michel/mqtt/qtmqtt/src/mqtt/qmqtttopicname.cpp:187:8: note: candidate 2: ‘size_t qHash(const QMqttTopicName&, size_t)’
    187 | size_t qHash(const QMqttTopicName &name, size_t seed) Q_DECL_NOTHROW

    Thank you in advance.

    Michel Arnaud

  • Lifetime Qt Champion

    Hi am welcome to devnet,

    What version of Qt ?
    What compiler ?
    What code ?

    Also, please do an out of source build.

  • @SGaist
    I resolved the problem
    I use Qt 5.12.8

    and I got the branch back :git clone --branch 5.12.8

    Thank you.

    Michel Arnaud

Log in to reply