Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Need help seeing my include
Qt 6.11 is out! See what's new in the release blog

Need help seeing my include

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 3 Posters 6.2k 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 am in #inlcude hell

    My original project works alone as expected.
    After converting it to library and adding to my subproject tree
    I am getting usual missing #include file - first time it is referenced .

    I am still not very comfortable with SUBDIRS "include" stricture and could use some help to figure out what is missing.

    I am not sure what is "include" hierarchy telling me.

    I suspect the main pro and its subproject project which uses the library is missing another "level " of include.

    Build fails in "device.h" , first "include" reference when used as library.

    35370dda-fe70-413e-8c2c-58f5ca9f50c0-image.png

    OK in project alone

    b2137a8c-f9cf-4ad5-b327-7a33f2ff702d-image.png

    Obviously my build does not get this far , it stops at device.h

    #include "device.h"
    #include "service.h"
    
    #include <qbluetoothaddress.h>
    #include <qbluetoothdevicediscoveryagent.h>
    #include <qbluetoothlocaldevice.h>
    #include <QMenu>
    #include <QDebug>
    
    1 Reply Last reply
    0
    • HansonH Offline
      HansonH Offline
      Hanson
      wrote on last edited by
      #2

      @AnneRanch said in Need help seeing my include:

      include
      you should add the AdditionalIncludeDirectories like "$(QTDIR)QtBluetooth"

      “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.”
      —— Martin Golding

      A 1 Reply Last reply
      0
      • HansonH Hanson

        @AnneRanch said in Need help seeing my include:

        include
        you should add the AdditionalIncludeDirectories like "$(QTDIR)QtBluetooth"

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        @Hanson Not sure where and how, but I like to know why.

        I have added

        INCLUDEPATH = "$(QTDIR)QtBluetooth"

        to pro file with no change .
        I like to identify the include tree/ chain for the bluetooth includes.
        I am working on that.

        1 Reply Last reply
        0
        • kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          There's no QTDIR environment variable, it used be set in Qt4 times but it since had been dropped. The Qt includes directory can be obtained by the qmake used to build the project:

          qmake -query QT_INSTALL_HEADERS
          

          Read and abide by the Qt Code of Conduct

          A 1 Reply Last reply
          0
          • kshegunovK kshegunov

            There's no QTDIR environment variable, it used be set in Qt4 times but it since had been dropped. The Qt includes directory can be obtained by the qmake used to build the project:

            qmake -query QT_INSTALL_HEADERS
            
            A Offline
            A Offline
            Anonymous_Banned275
            wrote on last edited by Anonymous_Banned275
            #5

            @kshegunov said in Need help seeing my include:

            There's no QTDIR environment variable, it used be set in Qt4 times but it since had been dropped. The Qt includes directory can be obtained by the qmake used to build the project:

            qmake -query QT_INSTALL_HEADERS
            

            OK, sounds too simple .
            I get this
            What is missing in command?


            qe@qe-desktop:~$ qmake -query QT_INSTALL_HEADERS
            /usr/include/x86_64-linux-gnu/qt5
            qe@qe-desktop:~$

            A recommended fix is to add
            INCLUDEPATH += (Base Path to openssl includes)
            to project file .

            How do I find base path for bluetooth ?

            kshegunovK 1 Reply Last reply
            0
            • A Anonymous_Banned275

              @kshegunov said in Need help seeing my include:

              There's no QTDIR environment variable, it used be set in Qt4 times but it since had been dropped. The Qt includes directory can be obtained by the qmake used to build the project:

              qmake -query QT_INSTALL_HEADERS
              

              OK, sounds too simple .
              I get this
              What is missing in command?


              qe@qe-desktop:~$ qmake -query QT_INSTALL_HEADERS
              /usr/include/x86_64-linux-gnu/qt5
              qe@qe-desktop:~$

              A recommended fix is to add
              INCLUDEPATH += (Base Path to openssl includes)
              to project file .

              How do I find base path for bluetooth ?

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by kshegunov
              #6

              @AnneRanch said in Need help seeing my include:

              /usr/include/x86_64-linux-gnu/qt5

              This is the system include directory. Meaning that you're building with a Qt provided by your package manager.

              A recommended fix is to add

              The recommendation's wrong. The system include dir is always searched as part of the build process. The headers are installed by your system package manager when you install the proper packages.
              If dpkg --list | grep libqt5bluetooth5 returns empty then you don't have the bluetooth module installed. Use apt-get, synaptic or whatever tool you use to manage your packages to install it.

              How do I find base path for bluetooth ?

              There's no such base path for the system provided module. It's under the Qt includes (as provided by qmake like above) under a directory named after the module. A piece of advice:

              #include <qbluetoothaddress.h>
              

              should be:

              #include <QBluetoothAddress>
              

              and also for the rest of the includes.

              Read and abide by the Qt Code of Conduct

              A 1 Reply Last reply
              3
              • kshegunovK kshegunov

                @AnneRanch said in Need help seeing my include:

                /usr/include/x86_64-linux-gnu/qt5

                This is the system include directory. Meaning that you're building with a Qt provided by your package manager.

                A recommended fix is to add

                The recommendation's wrong. The system include dir is always searched as part of the build process. The headers are installed by your system package manager when you install the proper packages.
                If dpkg --list | grep libqt5bluetooth5 returns empty then you don't have the bluetooth module installed. Use apt-get, synaptic or whatever tool you use to manage your packages to install it.

                How do I find base path for bluetooth ?

                There's no such base path for the system provided module. It's under the Qt includes (as provided by qmake like above) under a directory named after the module. A piece of advice:

                #include <qbluetoothaddress.h>
                

                should be:

                #include <QBluetoothAddress>
                

                and also for the rest of the includes.

                A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by Anonymous_Banned275
                #7

                @kshegunov Thanks I thinks I can digest your advise, it does not really tell how a project works.
                If I run the project as TEMPLATE = app it works just as expected. No problems wiht included.
                When I change the project TEMPLATE = lib it complies and complains I need to have executable. No problems with includes.
                When I attempt to use the what is now a static library , by another project in SUBDIRS - it fails to find the first include and stops to compile .
                I have a strange feeling the SUBDIRS projects are on different "loads of Qt"
                and SUDIRS does not care since they are "independent" , but will not work together as project and its library.

                And you post is pointing that way.
                I have a copy of compiler output and I may be able to prove this theory .

                Many thanks for your post, appreciate it .

                Now I have to make sure 5.15.2-2 IS USED by BOTH library and the client.

                qe@qe-desktop:~$ dpkg --list | grep libqt5bluetooth5
                ii libqt5bluetooth5:amd64 5.15.2-2 amd64 Qt Connectivity Bluetooth module
                ii libqt5bluetooth5-bin 5.15.2-2 amd64 Qt Connectivity Bluetooth module helper binaries
                qe@qe-desktop:~$

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

                  I am posting this in case somebody smarter than me can see the problem

                  I am not sure the answer is there , but it is a real place to check stuff.

                  AND I DO APOLOGIZE FOR TAKING SO MUCH MEMORY

                  I am posting this in case somebody smarter than me can see the problem 
                  
                  I am not sure the answer is there , but it is a real place to check stuff.
                  
                  AND I DO APOLOGIZE FOR TAKING SO MUCH MEMORY 
                  
                  
                  
                  
                  
                  
                  <pre>11:05:54: Running steps for project TEST_SUB...
                  11:05:54: Starting: "/usr/bin/make" clean -j4
                  rm -f moc_predefs.h
                  rm -f moc_mainwindow.cpp
                  rm -f ui_mainwindow.h
                  rm -f main.o mainwindow.o moc_mainwindow.o
                  rm -f *~ core *.core
                  11:05:54: The process "/usr/bin/make" exited normally.
                  11:05:55: Starting: "/home/qe/Qt_5/6.2.0/gcc_64/bin/qmake" /media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/FIRST_SUB/FIRST_SUB.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
                  11:05:55: The process "/home/qe/Qt_5/6.2.0/gcc_64/bin/qmake" exited normally.
                  11:05:55: Starting: "/usr/bin/make" -f /media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/build-TEST_SUB-Desktop_Qt_6_2_0_GCC_64bit-Debug/FIRST_SUB/Makefile qmake_all
                  make: Nothing to be done for 'qmake_all'.
                  11:05:55: The process "/usr/bin/make" exited normally.
                  11:05:55: Starting: "/usr/bin/make" -j4
                  /home/qe/Qt_5/6.2.0/gcc_64/libexec/uic ../../TEST_SUB/FIRST_SUB/mainwindow.ui -o ui_mainwindow.h
                  g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../TEST_SUB/FIRST_SUB -I. -I../../TEST_SUB/TEST_PROJECT -I../../TEST_SUB/TEST_LIBRARY -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -IQTDIR -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o main.o ../../TEST_SUB/FIRST_SUB/main.cpp
                  g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../TEST_SUB/FIRST_SUB -I. -I../../TEST_SUB/TEST_PROJECT -I../../TEST_SUB/TEST_LIBRARY -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -IQTDIR -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o mainwindow.o ../../TEST_SUB/FIRST_SUB/mainwindow.cpp
                  g++ -pipe -g -std=gnu++1z -Wall -Wextra -dM -E -o moc_predefs.h /home/qe/Qt_5/6.2.0/gcc_64/mkspecs/features/data/dummy.cpp
                  /home/qe/Qt_5/6.2.0/gcc_64/libexec/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include /media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/build-TEST_SUB-Desktop_Qt_6_2_0_GCC_64bit-Debug/FIRST_SUB/moc_predefs.h -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/FIRST_SUB -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/TEST_PROJECT -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/TEST_LIBRARY -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/FIRST_SUB/QTDIR -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I/usr/include/c++/10 -I/usr/include/x86_64-linux-gnu/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/x86_64-linux-gnu/10/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../TEST_SUB/FIRST_SUB/mainwindow.h -o moc_mainwindow.cpp
                  In file included from ../../TEST_SUB/FIRST_SUB/main.cpp:14:
                  /media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/device.h:56:10: fatal error: qbluetoothlocaldevice.h: No such file or directory
                     56 | #include <qbluetoothlocaldevice.h>
                        |          ^~~~~~~~~~~~~~~~~~~~~~~~~
                  compilation terminated.
                  make: *** [Makefile:1084: main.o] Error 1
                  make: *** Waiting for unfinished jobs....
                  11:06:03: The process "/usr/bin/make" exited with code 2.
                  Error while building/deploying project TEST_SUB (kit: Desktop Qt 6.2.0 GCC 64bit)
                  When executing step "Make"
                  11:06:03: Elapsed time: 00:09.
                  </pre>
                  

                  <pre>11:05:54: Running steps for project TEST_SUB...
                  11:05:54: Starting: "/usr/bin/make" clean -j4
                  rm -f moc_predefs.h
                  rm -f moc_mainwindow.cpp
                  rm -f ui_mainwindow.h
                  rm -f main.o mainwindow.o moc_mainwindow.o
                  rm -f *~ core *.core
                  11:05:54: The process "/usr/bin/make" exited normally.
                  11:05:55: Starting: "/home/qe/Qt_5/6.2.0/gcc_64/bin/qmake" /media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/FIRST_SUB/FIRST_SUB.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
                  11:05:55: The process "/home/qe/Qt_5/6.2.0/gcc_64/bin/qmake" exited normally.
                  11:05:55: Starting: "/usr/bin/make" -f /media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/build-TEST_SUB-Desktop_Qt_6_2_0_GCC_64bit-Debug/FIRST_SUB/Makefile qmake_all
                  make: Nothing to be done for 'qmake_all'.
                  11:05:55: The process "/usr/bin/make" exited normally.
                  11:05:55: Starting: "/usr/bin/make" -j4
                  /home/qe/Qt_5/6.2.0/gcc_64/libexec/uic ../../TEST_SUB/FIRST_SUB/mainwindow.ui -o ui_mainwindow.h
                  g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../TEST_SUB/FIRST_SUB -I. -I../../TEST_SUB/TEST_PROJECT -I../../TEST_SUB/TEST_LIBRARY -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -IQTDIR -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o main.o ../../TEST_SUB/FIRST_SUB/main.cpp
                  g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../TEST_SUB/FIRST_SUB -I. -I../../TEST_SUB/TEST_PROJECT -I../../TEST_SUB/TEST_LIBRARY -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -IQTDIR -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o mainwindow.o ../../TEST_SUB/FIRST_SUB/mainwindow.cpp
                  g++ -pipe -g -std=gnu++1z -Wall -Wextra -dM -E -o moc_predefs.h /home/qe/Qt_5/6.2.0/gcc_64/mkspecs/features/data/dummy.cpp
                  /home/qe/Qt_5/6.2.0/gcc_64/libexec/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include /media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/build-TEST_SUB-Desktop_Qt_6_2_0_GCC_64bit-Debug/FIRST_SUB/moc_predefs.h -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/FIRST_SUB -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/TEST_PROJECT -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/TEST_LIBRARY -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -I/media/qe/TSET_QT_LABEL/TEST_FOLDER/TEST_SUB_MAIN/TEST_SUB_PROJECT/TEST_SUB/FIRST_SUB/QTDIR -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I/usr/include/c++/10 -I/usr/include/x86_64-linux-gnu/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/x86_64-linux-gnu/10/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../TEST_SUB/FIRST_SUB/mainwindow.h -o moc_mainwindow.cpp
                  In file included from ../../TEST_SUB/FIRST_SUB/main.cpp:14:
                  /media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/device.h:56:10: fatal error: qbluetoothlocaldevice.h: No such file or directory
                  56 | #include <qbluetoothlocaldevice.h>
                  | ^~~~~~~~~~~~~~~~~~~~~~~~~
                  compilation terminated.
                  make: *** [Makefile:1084: main.o] Error 1
                  make: *** Waiting for unfinished jobs....
                  11:06:03: The process "/usr/bin/make" exited with code 2.
                  Error while building/deploying project TEST_SUB (kit: Desktop Qt 6.2.0 GCC 64bit)
                  When executing step "Make"
                  11:06:03: Elapsed time: 00:09.
                  </pre>

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

                    I am not sure about the code copy.
                    Anyway - I need to compare the library compile output, but I will not copy it here unless asked for.

                    kshegunovK 1 Reply Last reply
                    0
                    • A Anonymous_Banned275

                      I am not sure about the code copy.
                      Anyway - I need to compare the library compile output, but I will not copy it here unless asked for.

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by kshegunov
                      #10

                      Looking at the defines, I'm pretty sure you forgot to add the module to list in the .pro file (the QT variable).

                      Read and abide by the Qt Code of Conduct

                      A 1 Reply Last reply
                      1
                      • kshegunovK kshegunov

                        Looking at the defines, I'm pretty sure you forgot to add the module to list in the .pro file (the QT variable).

                        A Offline
                        A Offline
                        Anonymous_Banned275
                        wrote on last edited by
                        #11

                        @kshegunov said in Need help seeing my include:

                        Looking at the defines, I'm pretty sure you forgot to add the module to list in the .pro file (the QT variable).

                        You found the problem you are the man...
                        It complies and tun !

                        AS a poor excuse - I did not think the client using the library needs the module.
                        Lesson learn.
                        THANKS

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

                          @AnneRanch OK, I have one more request for help.
                          My project builds, I have added the library to one of the projects.
                          I have the library linked in .pro file.

                          unix:!macx: LIBS += -L$$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/ -lbtscanner

                          INCLUDEPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                          DEPENDPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source

                          unix:!macx: LIBS += -L$$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/ -lbtscanner

                          INCLUDEPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                          DEPENDPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                          .

                          unix:!macx: LIBS += -L$$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/ -lbtscanner

                          INCLUDEPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                          DEPENDPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source

                          I still cannot use the library.

                          The editor does not recognize
                          "btscanner"
                          I am still missing something and running out of ideas.

                          kshegunovK 1 Reply Last reply
                          0
                          • A Anonymous_Banned275

                            @AnneRanch OK, I have one more request for help.
                            My project builds, I have added the library to one of the projects.
                            I have the library linked in .pro file.

                            unix:!macx: LIBS += -L$$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/ -lbtscanner

                            INCLUDEPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                            DEPENDPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source

                            unix:!macx: LIBS += -L$$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/ -lbtscanner

                            INCLUDEPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                            DEPENDPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                            .

                            unix:!macx: LIBS += -L$$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/ -lbtscanner

                            INCLUDEPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source
                            DEPENDPATH += $$PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source

                            I still cannot use the library.

                            The editor does not recognize
                            "btscanner"
                            I am still missing something and running out of ideas.

                            kshegunovK Offline
                            kshegunovK Offline
                            kshegunov
                            Moderators
                            wrote on last edited by
                            #13

                            What's the exact errors?

                            Check the names and the paths, there should be libbtscanner.so inside $$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source or it won't build (drop the trailing / too).

                            If this library is a static one, you may want to force it within the PRE_TARGETDEPS[1].

                            [1] https://doc.qt.io/qt-5/qmake-variable-reference.html#pre-targetdeps

                            Read and abide by the Qt Code of Conduct

                            A 1 Reply Last reply
                            1
                            • kshegunovK kshegunov

                              What's the exact errors?

                              Check the names and the paths, there should be libbtscanner.so inside $$OUT_PWD/../../../../../QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source or it won't build (drop the trailing / too).

                              If this library is a static one, you may want to force it within the PRE_TARGETDEPS[1].

                              [1] https://doc.qt.io/qt-5/qmake-variable-reference.html#pre-targetdeps

                              A Offline
                              A Offline
                              Anonymous_Banned275
                              wrote on last edited by Anonymous_Banned275
                              #14

                              @kshegunov Here is a screen shot of the error , ignore the extra ")" error.
                              I'll check the path...
                              but I can see the build in compiler output ...
                              Should I post it ?

                              b63d89fa-cb49-4e14-b541-7eadc7e5726e-image.png

                              I decided to post part of the compiler output.
                              Could you give me an idea where in the output is the resulting library path?

                              -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_device.o moc_device.cpp
                              g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_service.o moc_service.cpp
                              rm -f libbtscanner.so.1.0.0 libbtscanner.so libbtscanner.so.1 libbtscanner.so.1.0
                              g++ -Wl,-rpath,/home/qe/Qt_5/6.2.0/gcc_64/lib -shared -Wl,-soname,libbtscanner.so.1 -o libbtscanner.so.1.0.0 main.o device.o service.o moc_device.o moc_service.o /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Bluetooth.so -pthread /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Network.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6DBus.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Widgets.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Gui.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Core.so -lpthread -lGL
                              ln -s libbtscanner.so.1.0.0 libbtscanner.so
                              ln -s libbtscanner.so.1.0.0 libbtscanner.so.1
                              ln -s libbtscanner.so.1.0.0 libbtscanner.so.1.0
                              09:37:11: The process "/usr/bin/make" exited normally.
                              09:37:11: Elapsed time: 00:22.

                              Here is how library project looks when built from scratch by Qt
                              Notice removal of gui and the
                              Default rules for deployment.

                              I did add DEFINES but not sure what the does.

                              I do not have either in my project I build from "normal" project by adding
                              TEMPLATE = lib

                              PS Looks as "tick tack toe" make a mess when copying . I am sure there is a hack to fix that.

                              QT -= gui
                              
                              TEMPLATE = lib
                              DEFINES += TEST_LIBRARY_LIBRARY
                              
                              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 += \
                                  test_library.cpp
                              
                              HEADERS += \
                                  TEST_LIBRARY_global.h \
                                  test_library.h
                              
                              # Default rules for deployment.
                              unix {
                                  target.path = /usr/lib
                              }
                              !isEmpty(target.path): INSTALLS += target
                              
                              
                              kshegunovK 1 Reply Last reply
                              0
                              • A Anonymous_Banned275

                                @kshegunov Here is a screen shot of the error , ignore the extra ")" error.
                                I'll check the path...
                                but I can see the build in compiler output ...
                                Should I post it ?

                                b63d89fa-cb49-4e14-b541-7eadc7e5726e-image.png

                                I decided to post part of the compiler output.
                                Could you give me an idea where in the output is the resulting library path?

                                -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_device.o moc_device.cpp
                                g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_service.o moc_service.cpp
                                rm -f libbtscanner.so.1.0.0 libbtscanner.so libbtscanner.so.1 libbtscanner.so.1.0
                                g++ -Wl,-rpath,/home/qe/Qt_5/6.2.0/gcc_64/lib -shared -Wl,-soname,libbtscanner.so.1 -o libbtscanner.so.1.0.0 main.o device.o service.o moc_device.o moc_service.o /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Bluetooth.so -pthread /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Network.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6DBus.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Widgets.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Gui.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Core.so -lpthread -lGL
                                ln -s libbtscanner.so.1.0.0 libbtscanner.so
                                ln -s libbtscanner.so.1.0.0 libbtscanner.so.1
                                ln -s libbtscanner.so.1.0.0 libbtscanner.so.1.0
                                09:37:11: The process "/usr/bin/make" exited normally.
                                09:37:11: Elapsed time: 00:22.

                                Here is how library project looks when built from scratch by Qt
                                Notice removal of gui and the
                                Default rules for deployment.

                                I did add DEFINES but not sure what the does.

                                I do not have either in my project I build from "normal" project by adding
                                TEMPLATE = lib

                                PS Looks as "tick tack toe" make a mess when copying . I am sure there is a hack to fix that.

                                QT -= gui
                                
                                TEMPLATE = lib
                                DEFINES += TEST_LIBRARY_LIBRARY
                                
                                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 += \
                                    test_library.cpp
                                
                                HEADERS += \
                                    TEST_LIBRARY_global.h \
                                    test_library.h
                                
                                # Default rules for deployment.
                                unix {
                                    target.path = /usr/lib
                                }
                                !isEmpty(target.path): INSTALLS += target
                                
                                
                                kshegunovK Offline
                                kshegunovK Offline
                                kshegunov
                                Moderators
                                wrote on last edited by kshegunov
                                #15

                                @AnneRanch said in Need help seeing my include:

                                but I can see the build in compiler output ...

                                The compiler complains that it doesn't know what the btscanner identifier means. It is missing a declaration or a definition, which usually means that the includes are wrong (somehow). Is this a function?

                                g++ -Wl,-rpath,/home/qe/Qt_5/6.2.0/gcc_64/lib -shared -Wl,-soname,libbtscanner.so.1 -o libbtscanner.so.1.0.0 main.o device.o service.o moc_device.o moc_service.o /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Bluetooth.so -pthread /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Network.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6DBus.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Widgets.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Gui.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Core.so -lpthread -lGL

                                That's the linker call, so the library is in /home/qe/Qt_5/6.2.0/gcc_64/lib, assuming that the rpath's set to the build directory.

                                I did add DEFINES but not sure what the does.

                                I don't follow. What defines and why?

                                PS Looks as "tick tack toe" make a mess when copying . I am sure there is a hack to fix that.
                                [snip]

                                If that's the project file that's supposed to use the btscanner library, then it is missing the proper INCLUDEPATH and the LIBS variables being filled in. It doesn't matter if that's an application or library (template) it still needs to link against the dependency to be able to use it.

                                Should look something like this:

                                HEADERS += \
                                    TEST_LIBRARY_global.h \
                                    test_library.h
                                
                                INCLUDEPATH += /home/qe/<...>/include<...>                   # Wherever the headers reside
                                LIBS += -L/home/qe/Qt_5/6.2.0/gcc_64/lib -lbtscanner
                                

                                Read and abide by the Qt Code of Conduct

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

                                  I am making some progress

                                  Here is part of the compiler / linker .
                                  It looks as linker is creating .a (shared ?) library.

                                  I have added -Wl --verbose , much needed tool to track what is happening ,and do not the see "btscanner.so" library build at all.

                                  I am going to see how adding the HEADER and INCLUDE to .pro file make a difference.

                                  IT SHOULD - I have been missing that from get go !!!

                                  /home/qe/Qt_5/6.2.0/gcc_64/libexec/moc -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include /media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/moc_predefs.h -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I/usr/include/c++/10 -I/usr/include/x86_64-linux-gnu/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/x86_64-linux-gnu/10/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include service.h -o moc_service.cpp
                                  g++ -c -pipe -g -fPIC -std=gnu++1z -Wall -Wextra -D_REENTRANT -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_device.o moc_device.cpp
                                  g++ -c -pipe -g -fPIC -std=gnu++1z -Wall -Wextra -D_REENTRANT -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_service.o moc_service.cpp
                                  rm -f libbtscanner.a
                                  ar cqs libbtscanner.a main.o device.o service.o moc_device.o moc_service.o

                                  kshegunovK 1 Reply Last reply
                                  0
                                  • kshegunovK kshegunov

                                    @AnneRanch said in Need help seeing my include:

                                    but I can see the build in compiler output ...

                                    The compiler complains that it doesn't know what the btscanner identifier means. It is missing a declaration or a definition, which usually means that the includes are wrong (somehow). Is this a function?

                                    g++ -Wl,-rpath,/home/qe/Qt_5/6.2.0/gcc_64/lib -shared -Wl,-soname,libbtscanner.so.1 -o libbtscanner.so.1.0.0 main.o device.o service.o moc_device.o moc_service.o /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Bluetooth.so -pthread /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Network.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6DBus.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Widgets.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Gui.so /home/qe/Qt_5/6.2.0/gcc_64/lib/libQt6Core.so -lpthread -lGL

                                    That's the linker call, so the library is in /home/qe/Qt_5/6.2.0/gcc_64/lib, assuming that the rpath's set to the build directory.

                                    I did add DEFINES but not sure what the does.

                                    I don't follow. What defines and why?

                                    PS Looks as "tick tack toe" make a mess when copying . I am sure there is a hack to fix that.
                                    [snip]

                                    If that's the project file that's supposed to use the btscanner library, then it is missing the proper INCLUDEPATH and the LIBS variables being filled in. It doesn't matter if that's an application or library (template) it still needs to link against the dependency to be able to use it.

                                    Should look something like this:

                                    HEADERS += \
                                        TEST_LIBRARY_global.h \
                                        test_library.h
                                    
                                    INCLUDEPATH += /home/qe/<...>/include<...>                   # Wherever the headers reside
                                    LIBS += -L/home/qe/Qt_5/6.2.0/gcc_64/lib -lbtscanner
                                    
                                    A Offline
                                    A Offline
                                    Anonymous_Banned275
                                    wrote on last edited by Anonymous_Banned275
                                    #17

                                    @kshegunov This is a very good point .

                                    "normal " code has
                                    header
                                    source file

                                    relations.

                                    now SUDDIRS adds .pro

                                    and default project mimic the

                                    header
                                    source file

                                    relation in .pro file

                                    without changing anything - not sure about that - done that few versions ago

                                    I can "include"
                                    a library header file in my .cpp file - the client reference point to library ( my inherited definition ) - editor(!) will complain if an attempt to include inaccessible file is made (nice real time feature kidos ) ,
                                    intelisense will display ONLY accessible files .

                                    What is suggested that IN ADDITION to C++ relations between client and library

                                    there need to be manually added "stuff " to .pro file where access to libray is desired.

                                    I would expect this to be done by SUBDIR option "add library" .
                                    Easy to
                                    verify.

                                    Sounds reasonable.

                                    HOWEVER, I now have another issue
                                    if I add
                                    CONFIG += staticlib - as recommended in other forum

                                    I get bscanner.a = not btscanner.so

                                    So I got two issues right now.
                                    This will take some time to fix stand by...

                                    1 Reply Last reply
                                    0
                                    • A Anonymous_Banned275

                                      I am making some progress

                                      Here is part of the compiler / linker .
                                      It looks as linker is creating .a (shared ?) library.

                                      I have added -Wl --verbose , much needed tool to track what is happening ,and do not the see "btscanner.so" library build at all.

                                      I am going to see how adding the HEADER and INCLUDE to .pro file make a difference.

                                      IT SHOULD - I have been missing that from get go !!!

                                      /home/qe/Qt_5/6.2.0/gcc_64/libexec/moc -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include /media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source/moc_predefs.h -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -I/media/qe/TSET_QT_LABEL/QT_6/QT6_PRO/CAT/SUB_PRO/EXAMPLES_COPY/QT_5/Examples/Qt-6.2.0/bluetooth/btscanner_source -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I/usr/include/c++/10 -I/usr/include/x86_64-linux-gnu/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/x86_64-linux-gnu/10/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include service.h -o moc_service.cpp
                                      g++ -c -pipe -g -fPIC -std=gnu++1z -Wall -Wextra -D_REENTRANT -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_device.o moc_device.cpp
                                      g++ -c -pipe -g -fPIC -std=gnu++1z -Wall -Wextra -D_REENTRANT -DBTSCANNER_PROJECT_LIBRARY -DQT_QML_DEBUG -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/qe/Qt_5/6.2.0/gcc_64/include -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtBluetooth -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtNetwork -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtDBus -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtWidgets -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtGui -I/home/qe/Qt_5/6.2.0/gcc_64/include/QtCore -I. -I. -I/home/qe/Qt_5/6.2.0/gcc_64/mkspecs/linux-g++ -o moc_service.o moc_service.cpp
                                      rm -f libbtscanner.a
                                      ar cqs libbtscanner.a main.o device.o service.o moc_device.o moc_service.o

                                      kshegunovK Offline
                                      kshegunovK Offline
                                      kshegunov
                                      Moderators
                                      wrote on last edited by kshegunov
                                      #18

                                      @AnneRanch said in Need help seeing my include:

                                      It looks as linker is creating .a (shared ?) library.

                                      That's an archive, a.k.a. a static library.

                                      now SUDDIRS adds .pro

                                      SUBDIRS is simply a tree-like build for qmake. It doesn't have to do with code at all. Each project is built separately and all considerations for stand-alone projects apply. The INCLUDEPATH is necessary for the compiler so it has the declarations avaialble, without it names (i.e. identifiers) mean nothing to it. LIBS is necessary for the linker, whenever it starts to resolve the objects it needs to know what symbol is defined in which binary (library, object file, executable).

                                      HOWEVER, I now have another issue
                                      if I add
                                      CONFIG += staticlib - as recommended in other forum

                                      Don't do that. Stick to dynamic libraries, it's simpler. Otherwise you need to satisfy the dependencies on the client side for the linking.
                                      Also on linux it's necessary as far as I recall to add the archive to the PRE_TARGETDEPS.

                                      Read and abide by the Qt Code of Conduct

                                      A 1 Reply Last reply
                                      2
                                      • kshegunovK kshegunov

                                        @AnneRanch said in Need help seeing my include:

                                        It looks as linker is creating .a (shared ?) library.

                                        That's an archive, a.k.a. a static library.

                                        now SUDDIRS adds .pro

                                        SUBDIRS is simply a tree-like build for qmake. It doesn't have to do with code at all. Each project is built separately and all considerations for stand-alone projects apply. The INCLUDEPATH is necessary for the compiler so it has the declarations avaialble, without it names (i.e. identifiers) mean nothing to it. LIBS is necessary for the linker, whenever it starts to resolve the objects it needs to know what symbol is defined in which binary (library, object file, executable).

                                        HOWEVER, I now have another issue
                                        if I add
                                        CONFIG += staticlib - as recommended in other forum

                                        Don't do that. Stick to dynamic libraries, it's simpler. Otherwise you need to satisfy the dependencies on the client side for the linking.
                                        Also on linux it's necessary as far as I recall to add the archive to the PRE_TARGETDEPS.

                                        A Offline
                                        A Offline
                                        Anonymous_Banned275
                                        wrote on last edited by
                                        #19

                                        @kshegunov said in Need help seeing my include:

                                        @AnneRanch said in Need help seeing my include:

                                        It looks as linker is creating .a (shared ?) library.

                                        That's an archive, a.k.a. a static library.

                                        now SUDDIRS adds .pro

                                        SUBDIRS is simply a tree-like build for qmake. It doesn't have to do with code at all. Each project is built separately and all considerations for stand-alone projects apply. The INCLUDEPATH is necessary for the compiler so it has the declarations avaialble, without it names (i.e. identifiers) mean nothing to it. LIBS is necessary for the linker, whenever it starts to resolve the objects it needs to know what symbol is defined in which binary (library, object file, executable).

                                        HOWEVER, I now have another issue
                                        if I add
                                        CONFIG += staticlib - as recommended in other forum

                                        Don't do that. Stick to dynamic libraries, it's simpler. Otherwise you need to satisfy the dependencies on the client side for the linking.
                                        Also on linux it's necessary as far as I recall to add the archive to the PRE_TARGETDEPS.

                                        Thanks for sticking with this mess.

                                        I decided to actually check if the .so library is built and where.
                                        Now I need to verify if that is for real as far as SUDIRS go.

                                        I really believe , I am convinced, I have created this myself by adding
                                        TEMPLATE = lib to the project.

                                        I have no issue using / accessing the real library , created by Qt SUDBIRS .

                                        There are copies of libbtscanner .so files :

                                        qe@qe-desktop:~$ find ./ -name "*btscanner.so"
                                        ./Qt_5/Examples/Qt-6.2.0/bluetooth/btscanner/libbtscanner.so
                                        ./Qt/Examples/Qt-5.15.2/bluetooth/build-btscanner-Desktop-Debug/libbtscanner.so
                                        qe@qe-desktop:~$

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

                                          I have rebuild my SUDIRS project .
                                          I have a main (widget) application and first subproject - widget application converted to library and another subproject - a real library crreated by Qt.

                                          No problem using the real library.
                                          Same problem using the converted library.

                                          Now the error is what has been suspect from get go

                                          bb4ab957-cb8c-463e-a1f1-8c48629d3818-image.png

                                          So a same error / story but now official.
                                          Hope I find the missing link soon...

                                          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