Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

  • Lifetime Qt Champion

    @ViniDalvino You did not mention which Qt version you're using and how you installed it.


  • Moderators

    @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


Log in to reply