簡體   English   中英

在QtCreator中找不到QtBluetooth Header / Cant包含它

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

這是我的第一個問題:)

我正在嘗試開發C ++應用程序,我可以使用它通過藍牙從台式機遠程控制Lego NXT。 為此,我想使用QBluetooth庫(以及其他QtGui Libs)。

我的問題是QBluetooth標頭不存在。 當我查看/ usr / include / qt5目錄時,得到以下信息:

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$ 

我找不到標題,並且當我想將它們包括在我的App(在QtCreator中)中時,自動完成功能將找不到它。 我已經在項目文件的“ QT”中添加了“藍牙”。

#-------------------------------------------------
#
# 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

你能幫我解決我的問題嗎?

這對我有用:

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)使

6)sudo make安裝

然后,我看到以下內容:

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   

至於find | grep blue find | grep blue >您可能希望查看-(i)name選項。

QT += core gui是不必要的,因為默認情況下會添加core和gui模塊。 我知道QtCreator默認添加它,但這是錯誤的。 意識到這一點很高興。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM