Unsolved Need help seeing my include
-
@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. -
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
-
@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 ?
-
@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.
Ifdpkg --list | grep libqt5bluetooth5
returns empty then you don't have the bluetooth module installed. Useapt-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.
-
@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:~$ -
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> -
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. -
Looking at the defines, I'm pretty sure you forgot to add the module to list in the .pro file (the
QT
variable). -
@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 -
@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_sourceunix:!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_sourceI still cannot use the library.
The editor does not recognize
"btscanner"
I am still missing something and running out of ideas. -
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
-
@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 ?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 = libPS 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
-
@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 properINCLUDEPATH
and theLIBS
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
-
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 -
@kshegunov This is a very good point .
"normal " code has
header
source filerelations.
now SUDDIRS adds .pro
and default project mimic the
header
source filerelation 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 forumI get bscanner.a = not btscanner.so
So I got two issues right now.
This will take some time to fix stand by... -
@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 forqmake
. It doesn't have to do with code at all. Each project is built separately and all considerations for stand-alone projects apply. TheINCLUDEPATH
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 forumDon'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 thePRE_TARGETDEPS
. -
@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 forqmake
. It doesn't have to do with code at all. Each project is built separately and all considerations for stand-alone projects apply. TheINCLUDEPATH
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 forumDon'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 thePRE_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:~$ -
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
So a same error / story but now official.
Hope I find the missing link soon... -
I have given up.
Trying to add plain project and converting it to library is futile.
I now have main SUBDIR project with "added library".
The library is build as SUBDIR internal library and added as such to main SUDBIR project. Works as expected.
I'll we transferring "btscanner" code example piece by piece to my library, hopefully learning more about Bluetooth in the process.I would like to express my appreciation to all who helped , albeit unsuccessfully , to fix this problem.
CASE closed