Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to use libusb for android at Qt Creatror.
Forum Updated to NodeBB v4.3 + New Features

How to use libusb for android at Qt Creatror.

Scheduled Pinned Locked Moved Mobile and Embedded
23 Posts 3 Posters 11.8k Views 1 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.
  • X Offline
    X Offline
    xmaze
    wrote on last edited by
    #11

    @LIBS += -L/home/unix/Downloads/libusb-master/android/libs/armeabi
    -lusb1.0
    INCLUDEPATH += /home/unix/Downloads/libusb-master/android/libs/armeabi@

    i have now this path to libraries, this is the builded one libraries with NDK. But its interesting, where can i learn how to use other libraries ? Now the libusb is embedded in APK file ?
    Can you explain if the Qt creator can build from source the libs for Android or how can i use other C libraries in Android Apps ?

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

      Qt Creator is an IDE, it can't build "any and every project". Depending on the library you'd like to use with android, you'll have to build them either using the library provided scripts or adapt it yourself.

      As for integrating other libraries, it's the same process you did for libusb

      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
      • X Offline
        X Offline
        xmaze
        wrote on last edited by
        #13

        That means that i have two choices, i can use the source code of a library direct into the project or to use a link to builded shared object ?

        am i right ?

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

          You can't always just include the source code of a library in your project. Some of them requires configuration to e.g. enable functionalities based on your system's installed libraries etc.

          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
          • X Offline
            X Offline
            xmaze
            wrote on last edited by
            #15

            i mean only for android because it's an external device and not my system. i think need to port the source code for Android or not ?

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

              That depends on the library and what it does

              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
              • S Offline
                S Offline
                sxubach
                wrote on last edited by
                #17

                Hello, I was trying to do exactly the same but I am having some problem following this indications. Right now I have

                LIBS += -L/home/toad/libusb-1.0.19/android/libs/armeabi-v7a -libusb1.0.so
                INCLUDEPATH += /home/toad/libusb-1.0.19/android/libs/armeabi-v7a
                

                and in the .cpp file I want to use the libarry I have

                #include <libusb.h>

                also tried

                #include "/home/esaote/libusb-1.0.19/android/libs/armeabi-v7a/libusb1.0.so"

                but it keeps on giving the error: undefined reference to 'libusb_whatever'

                What am I doing wrong?

                1 Reply Last reply
                0
                • X Offline
                  X Offline
                  xmaze
                  wrote on last edited by
                  #18

                  LIBS += -L/home/unix/Downloads/libusb-master/android/libs/armeabi-v7a\
                  -lusb1.0

                  this working for me , very important this slash,
                  -L/home/unix/Downloads/libusb-master/android/libs/armeabi-v7a\ <==== ()

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sxubach
                    wrote on last edited by
                    #19

                    without any include on the .cpp file?

                    1 Reply Last reply
                    0
                    • X Offline
                      X Offline
                      xmaze
                      wrote on last edited by
                      #20

                      only in .h file #include <libusb.h> and of course your INCLUDEPATH += /home/toad/
                      but not to lib, you need to point the source files from libusb , like this
                      INCLUDEPATH += /home/unix/Downloads/libusb-master/libusb

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        sxubach
                        wrote on last edited by
                        #21

                        Now I am exactly here:

                        [quote author="xmaze" date="1417649349"]@ LIBS += -L/home/unix/Downloads/libusb-master/android/libs/armeab
                        -l libusb1.0.so
                        INCLUDEPATH += /home/unix/Downloads/libusb-master/android/libs/armeabi @

                        i have made this changes but i have also the following error

                        @/home/unix/MyCODE/QT_Creator/src/librtlsdr.c:30: error: libusb.h: No such file or directory
                        #include <libusb.h>@

                        any ideas ?[/quote]

                        my libusb.h is in:
                        /home/toad/libusb-1.0.19/libusb/libusb.h

                        and in the .pro file I have
                        INCLUDEPATH += /home/toad/libusb-1.0.19/libusb

                        and in the .h I've tried both:
                        #include "/home/esaote/libusb-1.0.19/libusb/libusb.h"
                        #include <libusb.h>

                        1 Reply Last reply
                        0
                        • X Offline
                          X Offline
                          xmaze
                          wrote on last edited by
                          #22

                          the error has my path, are u sure that you changed ur path?

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            sxubach
                            wrote on last edited by
                            #23

                            Right now I have in the .pro file:

                            @
                            LIBS += -L/home/toad/libusb-1.0.19/android/libs/armeabi-v7a
                            -lusb1.0

                            INCLUDEPATH += /home/toad/libusb-1.0.19/android/libs/armeabi-v7a\
                            
                            INCLUDEPATH += /home/toad/libusb-1.0.19/libusb\
                            

                            @

                            If I am not wrong this looks pretty much like your final .pro file but adding the final line, this final line is the one we agreed I should write in order to be able to do in de .h file:

                            @
                            #include <libusb.h>
                            @

                            And with this (I am pretty much 100% the paths are correct, QT even autocompletes for me the include) it keeps on giving me the error:

                            libusb.h: No such file or directory
                            

                            on the other hand I don't understand either why I should include it I already made the ndk-make to build it in the libusb1.0.so that I am including in the .pro file

                            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