More #include questions...
-
I have manged to "add exiting project as library " to my MAIN subdirs .pro.
unix:!macx: LIBS += -L$$OUT_PWD/../../../../../../../../../../home/qe/Qt/Examples/Qt-5.15.2/bluetooth/btscanner/ -lbtscanner INCLUDEPATH += $$PWD/../../../../../../../../../../home/qe/Qt/Examples/Qt-5.15.2/bluetooth/btscanner DEPENDPATH += $$PWD/../../../../../../../../../../home/qe/Qt/Examples/Qt-5.15.2/bluetooth/btscannerThen I add #include "device.h" to my MAIN subdir main.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" **#include "device.h"** MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog(); DDD->show(); // test sub dialog // TEST_SUB_Dialog *TSD = new TEST_SUB_Dialog(); }Checking the added #include "device.h"
#ifndef DEVICE_H #define DEVICE_H #include "ui_device.h" #include <qbluetoothaddress.h> #include <qbluetoothdevicediscoveryagent.h> #include <qbluetoothlocaldevice.h> //.include <qbluetoothlocalde#vice.h> //#include <QBluetoothLocalDevice/qbluetoothlocalde#vice.h > #include <QDialog>I find another missing #inlcude(s) - however using "follow symbol under cursor" I can open the "missing #include <qbluetoothlocaldevice.h".
Obviously suddirs failed to add dependencies for "device"
- what is the proper - preferably using wizards - way to add such dependencies to "device" ?
- Why can I open the missing depended (downstream ) include but compiler cannot find it ?
- This is what "device .h include hierarchy " tells me

-
Hi,
@AnneRanch said in More #include questions...:
QBluetoothLocalDevice
That's a class from the QtBluetooth module. If it's included in one of your class header you need to add
QT += bluetoothto the project that uses your library. -
SOLVED
The project .pro file I added as library DOES have QT bluetooth
as first line of .pro
For good measure I have added this to my main project.''QT += core gui core bluetooth widgets
So the moral of the story is
add QT object macro to the .pro file of appropriate .pro file MANUALLY