Undefined reference to QtBluetooth class member functions all over Qt project



  • Hello,

    I configured my Qt Creator to build apps for the i.MX6Q SABRE SD board from Freescale. I followed the guide here: https://community.freescale.com/thread/309578 and my settings are similar to the guide. I have built some apps for my board using these settings and they run fine. I tried building the bluetooth example apps from Qt Connectivity from here:https://qt.gitorious.org/qt/qtconnectivity/source/90448d592bb8b38ac544e868c6e5db9bf37168d8:, but encountered numerous "Undefined reference to .." errors, that point to various members of the QtBluetooth and their functions. Here is a snippet of the compile output:

    @
    chat.o: In function Chat::Chat(QWidget*)': /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:84: undefined reference toQtBluetooth::QBluetoothLocalDevice::QBluetoothLocalDevice(QObject*)'
    /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:84: undefined reference to QtBluetooth::QBluetoothLocalDevice::name() const' /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:84: undefined reference toQtBluetooth::QBluetoothLocalDevice::~QBluetoothLocalDevice()'
    /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:84: undefined reference to QtBluetooth::QBluetoothLocalDevice::~QBluetoothLocalDevice()' chat.o: In functionChat::connectClicked()':
    /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:131: undefined reference to QtBluetooth::QBluetoothUuid::QBluetoothUuid(QString const&)' /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:131: undefined reference toQtBluetooth::QBluetoothUuid::~QBluetoothUuid()'
    chat.o: In function QtBluetooth::QBluetoothServiceInfo::serviceName() const': /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../../src/bluetooth/qbluetoothserviceinfo.h:185: undefined reference toQtBluetooth::QBluetoothServiceInfo::attribute(unsigned short) const'
    chat.o: In function Chat::connectClicked()': /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:136: undefined reference toQtBluetooth::QBluetoothServiceInfo::device() const'
    /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:136: undefined reference to QtBluetooth::QBluetoothDeviceInfo::name() const' /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:136: undefined reference toQtBluetooth::QBluetoothDeviceInfo::~QBluetoothDeviceInfo()'
    /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:151: undefined reference to QtBluetooth::QBluetoothServiceInfo::~QBluetoothServiceInfo()' /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:151: undefined reference toQtBluetooth::QBluetoothServiceInfo::~QBluetoothServiceInfo()'
    /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:136: undefined reference to QtBluetooth::QBluetoothDeviceInfo::~QBluetoothDeviceInfo()' /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chat.cpp:131: undefined reference toQtBluetooth::QBluetoothUuid::~QBluetoothUuid()'
    chatserver.o: In function ChatServer::ChatServer(QObject*)': /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chatserver.cpp:51: undefined reference toQtBluetooth::QBluetoothServiceInfo::QBluetoothServiceInfo()'
    chatserver.o: In function ChatServer::stopServer()': /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chatserver.cpp:118: undefined reference toQtBluetooth::QBluetoothServiceInfo::unregisterService() const'
    chatserver.o: In function qobject_cast<QtBluetooth::QBluetoothSocket*>': /opt/poky/1.5.3/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi//usr/include/qt4/QtCore/qobject.h:380: undefined reference toQtBluetooth::QBluetoothSocket::staticMetaObject'
    /opt/poky/1.5.3/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi//usr/include/qt4/QtCore/qobject.h:380: undefined reference to QtBluetooth::QBluetoothSocket::staticMetaObject' chatserver.o: In functionChatServer::readSocket()':
    /home/dave/Desktop/OBU/BT/qt-qtconnectivity/examples/build-bluetooth-Yocto_sh-Debug/btchat/../../bluetooth/btchat/chatserver.cpp:179: undefined reference to `QtBluetooth::QBluetoothSocket::peerName() const'
    @

    I was thinking the problem stems from the fact that I am using an older version of Qt (4.8.5), since the target board supports only up to that version I think. Also, at the start of the compile process I get warnings like this:

    @
    Project MESSAGE: Warning: unknown QT: bluetooth
    Project MESSAGE: Warning: unknown QT: quick
    @

    From what I've read so far "quick" is only for Qt5, and "declarative" is its Qt4 counterpart, so I replaced all instances of quick, QQuick and QtQuick with declarative QDeclarative and QtDeclarative. But I still get warnings for unknown QT: bluetooth.

    Anyone can help me with this? Thanks



  • Bluetooth module is in Qt since 5.2 version.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.