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. Adding "blueZ" library - linker options where ?
Forum Updated to NodeBB v4.3 + New Features

Adding "blueZ" library - linker options where ?

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 5 Posters 1.6k Views 3 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 decided to try using plain "blueZ" library.
    I have added necessary #include to my common header.

    Now need some help with the following

    1. I have "include" headers in .pro
       bluez/lib/bluetooth.h \
        bluez/lib/hci.h \
        bluez/lib/hci_lib.h
    
    1. I also have #include in my common header
    // NOTE fixed path
    #include </media/f/QT/QT_PROJECT/CAT_V1/bluez/lib/bluetooth.h>
    #include </media/f/QT/QT_PROJECT/CAT_V1/bluez/lib/hci.h>
    #include </media/f/QT/QT_PROJECT/CAT_V1/bluez/lib/hci_lib.h>
    
    

    Which is proper way to #include these "external file" headers in QtCreator project?
    I like to have "variable path" - I keep my versions by changing the "CAT_Vx" part which is currently fixed to "CAT_V1".

    I have no idea how to add "libbluetooth" AKA -lbluetooth to / where in QtCreator .
    I am using GCC so I need to add "-lbluetooth" to linker options.

    Where do I add it?

     To compile our program, invoke gcc and link against libbluetooth
    
    # gcc -o simplescan simplescan.c -lbluetooth 
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #15

      If you have a grub issue then you have a system issue that is unrelated to Qt nor programming so there's indeed something messed up with your computer.

      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
      2
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        See the LIBS command

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

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

          Hi,

          To add to @Christian-Ehrlicher: look at the qmake documentation.

          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
          2
          • A Offline
            A Offline
            Anonymous_Banned275
            wrote on last edited by
            #4

            I found this to add to .pro

            LIBS += -lbluetooth

            now I need to add path

            Christian EhrlicherC 1 Reply Last reply
            0
            • A Anonymous_Banned275

              I found this to add to .pro

              LIBS += -lbluetooth

              now I need to add path

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #5

              @AnneRanch said in Adding "blueZ" library - linker options where ?:

              now I need to add path

              And what hinders you to add it?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              A 1 Reply Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

                @AnneRanch said in Adding "blueZ" library - linker options where ?:

                now I need to add path

                And what hinders you to add it?

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

                @Christian-Ehrlicher said in Adding "blueZ" library - linker options where ?:

                @AnneRanch said in Adding "blueZ" library - linker options where ?:

                now I need to add path

                And what hinders you to add it?

                I cannot "search for "bluetooth" file using "find . -name "bluetooth" I am getting folders , not a file.

                mrjjM 1 Reply Last reply
                0
                • A Anonymous_Banned275

                  @Christian-Ehrlicher said in Adding "blueZ" library - linker options where ?:

                  @AnneRanch said in Adding "blueZ" library - linker options where ?:

                  now I need to add path

                  And what hinders you to add it?

                  I cannot "search for "bluetooth" file using "find . -name "bluetooth" I am getting folders , not a file.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @AnneRanch
                  Hi
                  The syntax is like
                  LIBS += -L/usr/local/lib -lmath
                  so with big -L we can give the path and with little -l we give the library name.

                  I assume that is what you mean by adding path ?

                  A 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @AnneRanch
                    Hi
                    The syntax is like
                    LIBS += -L/usr/local/lib -lmath
                    so with big -L we can give the path and with little -l we give the library name.

                    I assume that is what you mean by adding path ?

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

                    @mrjj Yes, but the -L path is wrong

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

                      "I am sooo confused..."
                      Should
                      sudo apt-get install libbluetooth-dev
                      install , by default, into

                      /usr/include/bluetooth ??

                      How do I get "bluetooth" out of

                      libbluetooth-dev ?

                      doesn't GCC works with "static" or "shared" library as oppose of Windows "DLL" ?

                      And how does .pro

                      QT bluetooth

                      fits into scheme of things?

                      jsulmJ 1 Reply Last reply
                      0
                      • A Anonymous_Banned275

                        "I am sooo confused..."
                        Should
                        sudo apt-get install libbluetooth-dev
                        install , by default, into

                        /usr/include/bluetooth ??

                        How do I get "bluetooth" out of

                        libbluetooth-dev ?

                        doesn't GCC works with "static" or "shared" library as oppose of Windows "DLL" ?

                        And how does .pro

                        QT bluetooth

                        fits into scheme of things?

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        @AnneRanch said in Adding "blueZ" library - linker options where ?:

                        libbluetooth-dev

                        This installs the include files, not the lib itself, so it has no relation to -L.
                        You need libbluetooth to get the lib and in that package you can see where the lib is installed.
                        Using the packages of your distribution there is no need to use -L as the lib will be installed in standard libs location.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        A 1 Reply Last reply
                        2
                        • jsulmJ jsulm

                          @AnneRanch said in Adding "blueZ" library - linker options where ?:

                          libbluetooth-dev

                          This installs the include files, not the lib itself, so it has no relation to -L.
                          You need libbluetooth to get the lib and in that package you can see where the lib is installed.
                          Using the packages of your distribution there is no need to use -L as the lib will be installed in standard libs location.

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

                          @jsulm
                          Sorry , but my problem is in OS itself - it refuses to install libbluetooth-dev for so far unknown reason.

                          Please put this thread on hold until I fix that.

                          BTW one can install library using menu in .pro file, of course one has to know from where and what. Duh.
                          Then the -L/-l options are handled by QtCreator itself.

                          9eee13b3-7332-4192-aba9-8265fa53b974-image.png

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

                            Since you installed that library through the package manager, the paths shall already be good and you just have to link to the appropriate library.

                            Since you are on Linux you can also take advantage of pkg-config and use:

                            CONFIG += link_pkgconfig
                            PKGCONFIG += bluez
                            

                            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
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #13

                              @AnneRanch said in Adding "blueZ" library - linker options where ?:

                              Sorry , but my problem is in OS itself - it refuses to install libbluetooth-dev for so far unknown reason.

                              What exact error do you get ?

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

                              A 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                @AnneRanch said in Adding "blueZ" library - linker options where ?:

                                Sorry , but my problem is in OS itself - it refuses to install libbluetooth-dev for so far unknown reason.

                                What exact error do you get ?

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

                                @SGaist I am not sure I want to discuss it here in public. Is is rather complex , but if you re interested - is there away I can send it to you private or do you want the link to the "Linux" forum? That wold save me time.
                                Basically some issue with "grub" unable to "update / upgrade" and consequently "install" also fails. Pretty messy.

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

                                  If you have a grub issue then you have a system issue that is unrelated to Qt nor programming so there's indeed something messed up with your computer.

                                  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
                                  2

                                  • Login

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