这是我的第一个问题:)
我正在尝试开发一个C++应用程序,我可以用它来通过蓝牙从我的桌面PC远程控制乐高NXT。为了实现这一点,我希望使用QBluetooth库(以及其他QtGui库)。
我的问题是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$ 我找不到标题,当我想将它们包含在我的应用程序(在QtCreator中)时,AutoCompletion不会找到它。我已经在我的项目文件中添加了“蓝牙”到"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你能帮我解决我的问题吗?
发布于 2014-05-16 20:31:38
这对我来说很管用:
1) wget releases/qt/5.3/5.3.0-rc/submodules/qtconnectivity-opensource-src-5.3.0-RC.tar.xz
2) tar xvpf src连接-opensource-src-5.3.0-rc.tar.xz
3) cd RC连通性-开放源码-src-5.3.0-RC
4) qmake -r
5)使
6) sudo制造安装
然后,我看到了这个:
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 ->,您可能希望查看-(i)name选项。
QT += core gui是不必要的,因为在默认情况下添加了核心模块和gui模块。我知道QtCreator默认添加它,但它是错误的。意识到这一点是很好的。
https://stackoverflow.com/questions/23703339
复制相似问题