Results 1 to 4 of 4

Thread: QtBluetooth - Linker Problems

  1. #1
    Join Date
    May 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows Maemo/MeeGo

    Question QtBluetooth - Linker Problems

    Hello everyone!

    I'm a student in electical engineering, having some troubles with C++ / Qt Programming. For a students project, I've to program a simple app on Sailfish OS (Device: Jolla 1, QtBluetooth 5.2) which listens to UDP datagrams (that works well) and hands them over to a Bluetooth SPP connection (rfcomm protocol). It's mainly just a control software for a RGBW lamp, which gets connected via BT.

    UDP and Bluetooth are in the same project, accessing the same include-space.
    While my UDP connection works flawlessly, the Bluetooth code causes the linker to stop and hand out the error:
    \home\mersdk\share\LightCubeServer\src\btconn.cpp: 14: Error: undefined reference to `QBluetoothServer::QBluetoothServer(QBluetoothServ iceInfo::Protocol, QObject*)'
    After spending two weekends of reading documentations, I've no clue on what to do anymore. I even attached the corresponding include files to the project, which didn't change anything.

    The Header file btconn.h:
    Qt Code:
    1. #include <QtCore/QObject>
    2. #include <QtBluetooth/QBluetoothServer>
    3.  
    4. QT_FORWARD_DECLARE_CLASS(QBluetoothServer)
    5.  
    6. class BtConn : public QObject
    7. {
    8. Q_OBJECT
    9. public:
    10. explicit BtConn(QObject *parent = 0); // Constructor
    11. void startServer(const QBluetoothAddress &localAdapter = QBluetoothAddress()); // Method used for starting the server
    12. private:
    13. QBluetoothServer *rfcommServer; // Variable for Server-Instance
    14. };
    To copy to clipboard, switch view to plain text mode 

    and the Code File btconn.cpp:

    Qt Code:
    1. #include "btconn.h"
    2.  
    3. BtConn::BtConn(QObject *parent) : QObject(parent)
    4. {
    5. // Constructor won't do anything
    6. }
    7.  
    8. // Start the Bluetooth Server
    9. void BtConn::startServer(const QBluetoothAddress& localAdapter)
    10. {
    11. if (rfcommServer)
    12. return;
    13.  
    14. rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
    15.  
    16. }
    To copy to clipboard, switch view to plain text mode 


    I really hope that someone has an idea on how to solve that problem.

    Best regards

    PS: English isn't my main language - sorry for typos and grammar mistakes.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QtBluetooth - Linker Problems

    Did you make sure that the Qt you are linking against was built with BT support?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows Maemo/MeeGo

    Default Re: QtBluetooth - Linker Problems

    It should be - the QML Classes (BluetoothSocket, BluetoothAddress and BluetoothDiscoveryModel) work properly - but sadly, with QML only, I can't set up a Bluetooth Server which is needed for pairing with a slave device. For that, I need the QBluetoothServer C++ Class which seems to be faulty.

    There are also code samples for Sailfish OS and Bluetooth on the web, but without the QBluetoothServer since they seem to want to pair the device with other "intelligent" devices.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QtBluetooth - Linker Problems

    Seems this might be a Sailfish issue.
    https://together.jolla.com/question/...oth-bluetooth/
    Some of the comments are from as as late as Jan 2017.
    So maybe you can ask in more Saidfish/Jolla forums.
    Also, have you read through this page?:
    http://doc.qt.io/qt-5/qtbluetooth-in...g-qt-bluetooth
    Seems support my vary...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QtBluetooth Qt5.3
    By bounce in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th September 2014, 10:54
  2. Problems with linker after updating from 5.2.0 to 5.2.1 MacOSX
    By Smosia in forum Installation and Deployment
    Replies: 1
    Last Post: 7th April 2014, 18:05
  3. OpenCV again (Linker Problems)
    By embedded123 in forum Newbie
    Replies: 1
    Last Post: 28th April 2011, 12:32
  4. Qt4 Lib -- Linker Problems Qt4/OpenGL
    By Jackson.Shredder in forum Qt Programming
    Replies: 6
    Last Post: 19th January 2009, 19:22
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 23:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.