:-1: error: Unknown module(s) in QT: bluetooth; When trying to play around with the bluetooth functionallity of qt
-
I was trying to play around with QT bluetooth features however it gave me
:-1: error: Unknown module(s) in QT: bluetooth;
when trying to compile my code. I use windows 10 wiith msvc. Here is my code:#include "mainwindow.h" #include "ui_mainwindow.h" #include <QtBluetooth/QBluetoothDeviceInfo> #include <QtBluetooth/QBluetoothAddress> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_DispHeadphoneInfo_clicked() { QBluetoothAddress headphoneAdrr("38:18:4C:02:F6:79"); // QBluetoothDeviceInfo headphoneInfo(*headphoneAdrr, "Sony WH-Ch700N", ) }
Here is my qmake file:
QT += core gui QT += bluetooth; greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
-
@ViniDalvino You did not mention which Qt version you're using and how you installed it.
-
@ViniDalvino said in :-1: error: Unknown module(s) in QT: bluetooth; When trying to play around with the bluetooth functionallity of qt:
QT += bluetooth;
I Don't know how qmake handles semicolons, I would imagine not well, remove it
-
-
@Christian-Ehrlicher Hey, I have installed QT 6.1.0. from this site: https://www.qt.io/download-qt-installer?hsCtaTracking=99d9dd4f-5681-48d2-b096-470725510d34|074ddad0-fdef-4e53-8aa8-5e8a876d6ab4 . The downloaded file was named: qt-unified-windows-x86-4.0.1-1-online.
Also, I am using Windows 10 with MinGW 64 bit compiler. -
@Aayushi said in :-1: error: Unknown module(s) in QT: bluetooth; When trying to play around with the bluetooth functionallity of qt:
Hey, I have installed QT 6.1.0
Bluetooth is not yet supported in Qt 6. See https://www.qt.io/blog/add-on-support-in-qt-6.0-and-beyond
Install Qt 5.15.2 to use the Qt Bluetooth module.