Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. More #include questions...
Qt 6.11 is out! See what's new in the release blog

More #include questions...

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 653 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    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/btscanner
    
    

    Then 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"

    1. what is the proper - preferably using wizards - way to add such dependencies to "device" ?
    2. Why can I open the missing depended (downstream ) include but compiler cannot find it ?
    3. This is what "device .h include hierarchy " tells me

    9942c5d7-5725-42f8-a02f-ce629232582e-image.png

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 += bluetooth to the project that uses your library.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved