Can't find QtBluetooth Header/Cant include it in QtCreator

2.4k views Asked by At

its my first Question here :)

Im trying to develop a C++ Application which i can use to control a Lego NXT remotely from my Desktop PC over Bluetooth. To achieve this i want to use the QBluetooth Library(and other QtGui Libs aswell).

My Problem is the QBluetooth Headers are not there. When i look into the /usr/include/qt5 directory i get this:

paul@Paul-RoboAG:/usr/include/qt5$ ls
QtConcurrent  QtNetwork           QtPrintSupport    QtQuickTest  QtXml
QtCore        QtOpenGL            QtQml             QtSql
QtDBus        QtOpenGLExtensions  QtQuick           QtTest
QtGui         QtPlatformSupport   QtQuickParticles  QtWidgets
paul@Paul-RoboAG:/usr/include/qt5$ find | grep Blue
paul@Paul-RoboAG:/usr/include/qt5$ find | grep blue
paul@Paul-RoboAG:/usr/include/qt5$ 

I dont find the headers, and when i want to include them in my App(in QtCreator) the AutoCompletion wont find it. I Already added "bluetooth" to "QT" in my project file.

#-------------------------------------------------
#
# Project created by QtCreator 2014-05-16T21:06:59
#
#-------------------------------------------------

QT       += core gui
QT       += bluetooth

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = NXT-Control
TEMPLATE = app


SOURCES += main.cpp\
        nxtcontroller.cpp

HEADERS  += nxtcontroller.h

Can you help me with my problem?

1

There are 1 answers

3
László Papp On BEST ANSWER

This works for me:

1) wget http://download.qt-project.org/development_releases/qt/5.3/5.3.0-rc/submodules/qtconnectivity-opensource-src-5.3.0-RC.tar.xz

2) tar xvpf qtconnectivity-opensource-src-5.3.0-RC.tar.xz

3) cd qtconnectivity-opensource-src-5.3.0-RC

4) qmake -r

5) make

6) sudo make install

Then, I see this:

ls /usr/include/qt/QtBluetooth/
5.3.0/                             qbluetoothglobal.h                 qbluetoothserver.h                 QBluetoothTransferManager          qbluetoothuuid.h
QBluetoothAddress                  qbluetooth.h                       QBluetoothServiceDiscoveryAgent    qbluetoothtransfermanager.h        QtBluetooth
qbluetoothaddress.h                QBluetoothHostInfo                 qbluetoothservicediscoveryagent.h  QBluetoothTransferReply            QtBluetoothDepends
QBluetoothDeviceDiscoveryAgent     qbluetoothhostinfo.h               QBluetoothServiceInfo              qbluetoothtransferreply.h          QtBluetoothVersion
qbluetoothdevicediscoveryagent.h   QBluetoothLocalDevice              qbluetoothserviceinfo.h            QBluetoothTransferRequest          qtbluetoothversion.h
QBluetoothDeviceInfo               qbluetoothlocaldevice.h            QBluetoothSocket                   qbluetoothtransferrequest.h        
qbluetoothdeviceinfo.h             QBluetoothServer                   qbluetoothsocket.h                 QBluetoothUuid   

As for find | grep blue -> you may wish to take a look at the -(i)name option.

QT += core gui is needless because the core and gui modules are added by default. I know that QtCreator adds it by default, but it is wrong. It is good to be aware of it.