Qt World Summit: Register Today!

Qt4 Bluetooth Rfcomm problem I

  • Hello,

    I am new to Qt, and I want to make an app on an embedded linux device in Qt4 that send and receives some data throw bluetooth from another device using SPP and RFOMM. I want to use theBT functions from #include<bluetooth/bluetooth.h> and #include<bluetooth/rfcomm.h> which are written in C, but I cannot compile them in Qt Creator.

    So my question is how do I compile these 2 includes in Qt or is there another way to use rfcomm and bluetooth?Thank you very much.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Since you are using linux, did you took a look at the Qt's bluetooth module ?

  • Hello,

    I am new to Qt and from what I have read for Qt 4 I would have to use Qt mobility 1.2 which contains the bluetooth module but I cannot find a valid link to download http://doc-snapshot.qt-project.org/qt-mobility/qtmobility-release-notes.html . I am using Qt 4.8.4 and QtCreator 2.7.1. Thank you

  • Lifetime Qt Champion

    You can clone it "here":https://qt.gitorious.org/qt-mobility

  • Hello,

    Thanks for the link, I have made a clone, installed it using the steps from http://doc.qt.digia.com/qtmobility/installation.html but QtCreator doesn't recognize it.
    I had installed the Qt Mobility into the QtCreator folder, I see now there is a folder /lib and /include which contains all sort of librarys and headers for Qt Mobility.
    What could be the problem? Thank you

    Here is my .pro file content:


    Project created by QtCreator 2014-04-27T09:10:17


    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = NewBlue
    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += dialog.h

    FORMS += dialog.ui

    CONFIG += mobility
    MOBILITY = connectivity@

    And the main.cpp where I have just inserted #include<qbluetoothserviceinfo.h> and #include <qbluetoothsocket.h> from the bttennis example :

    @#include "dialog.h"
    #include <QApplication>
    #include <qbluetoothserviceinfo.h>
    #include <qbluetoothsocket.h>


    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    Dialog w;

    return a.exec&#40;&#41;;


    I get the following error:

    ../NewBlue/main.cpp:3:35: fatal error: qbluetoothserviceinfo.h: No such file or directory
    compilation terminated.
    make: *** [main.o] Error 1
    10:04:41: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project NewBlue (kit: Sitara AM335x)
    When executing step 'Make'
    10:04:41: Elapsed time: 00:00.

    And here is my .profile file where in the installation I have added the LD_LIBRARY_PATH using gedit from Linux.

    ~/.profile: executed by the command interpreter for login shells.

    This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login


    see /usr/share/doc/bash/examples/startup-files for examples.

    the files are located in the bash-doc package.

    the default umask is set in /etc/profile; for setting the umask

    for ssh logins, install and configure the libpam-umask package.

    #umask 022

    if running bash

    if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"

    set PATH so it includes user's private bin if it exists

    if [ -d "$HOME/bin" ] ; then

    QMAKESPEC=/home/claudiu/ti-sdk-am335x-evm-;export QMAKESPEC; # ADDED BY INSTALLER - DO NOT EDIT OR DELETE THIS COMMENT - AB1C36D0-2B62-930A-B1CF-1B15CF69BE47 90FD792D-9FFB-93E9-DFD8-E1F4A2589281

    LD_LIBRARY_PATH=/home/claudiu/qtcreator-2.7.1/lib:$LD_LIBRARY_PATH;export LD_LIBRARY_PATH;

  • Lifetime Qt Champion

    For the include part your should use

    @#include <QBluetoothServiceInfo>@

    Did you correctly called "make install" after you have built Qt Mobility ?

  • Hello,

    This are the exact steps I made:
    source /home/claudiu/ti-sdk-am335x-evm-
    cd /home/claudiu/qt-mobility-cmosneangs-qt-mobility2
    ./configure -prefix /home/claudiu/qtcreator-2.7.1
    make install
    cd /home/claudiu
    gedit .profile

    I changed dir to the folder where I have uncompressed the qt-mobility and then I run configure to the folder where the qtcreator is located and make and make install.

  • Lifetime Qt Champion

    Are you cross-compiling it ?

    You should not install Qt Mobility in Qt Creator, it's not its place

  • Hello,

    Yes I am writing the application for an ARM Linux Device named Sitara AM335x, I am new to Qt and Linux so where should I install Qt Mobility?

  • Lifetime Qt Champion

    Besides your cross-compiled Qt directory. If you have e.g. /usr/local/Trolltech/Qt-Embedded-4.8.6 then install Mobility in /usr/locat/Trolltech/Qt-Mobility-Embedded-4.8.6

    If you are developing/testing on your computer before building for your ARM board, then you must also compile Qt Mobility for your desktop Qt

  • Hello,

    So if I use /home/claudiu/ti-sdk-am335x-evm- where I have the compilers for my ARM board I should install Qt-mobility there and put the LD_LIBRARY_PATH to point to that folder? Even if QtCreator folder is on /home/claudiu/qtcreator-2.7.1?
    I am not testing on my computer, I am deploying on the board from Qt Creator.
    Thank you.

  • Lifetime Qt Champion

    Qt Creator is an IDE, it doesn't contain any Qt version to use for developing.

    Like I said the best if to install it in the same folder where you have your Qt ARM version

  • hello there,
    i have the same problem with ti-sdk-am335x-evm-, does it support qt mobility "Location & position"?? because it didn't work with me !! , the new ti-sdk-am335x-evm- is support until QT 5.5 but i need to know how to setup this lib with the ti-sdk-am335x-evm-0x.00.00.00 to enable qt creator to deploy my apps in the EVM, what should i do ??
    thanks in advance ...

  • Lifetime Qt Champion

    Qt Mobility is needed for Qt 4. Qt 5.5 has both Qt Location and Qt Positioning modules

  • hi @SGaist
    thanks for replying, that mean if i need to use Qt location i must use qt5 rit ?
    okay sorry but i need to ask this , did the QgeoMap support for offline map work or it just work online with the given servers providers !?

  • Lifetime Qt Champion

    Qt Location is indeed a Qt 5 module.

    AFAIK, Qt 5 has currently no offline plugin.

Log in to reply