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. Error using libusb library
Forum Updated to NodeBB v4.3 + New Features

Error using libusb library

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.6k Views
  • 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
    Andrew23
    wrote on last edited by
    #1

    I'm working to manage the USB communication between a Qt application and a PIC32 microcontroller device seen as a vendor class device. In the Microchip forum they suggested me to start from one application example written in Qt5 within their MLA library pakage. But now I'm trying to run the example but I get the following errorrs:

    :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.lib when searching for -llibusb-1.0
    :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.dll when searching for -llibusb-1.0
    :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.lib when searching for -llibusb-1.0
    :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.dll when searching for -llibusb-1.0
    :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src\libusb-1.0.lib when searching for -llibusb-1.0
    :-1: error: cannot find -llibusb-1.0
    :-1: error: collect2.exe: error: ld returned 1 exit status
    :-1: error: [Makefile.Debug:78: windows/libusb_Demo.exe] Error 1
    

    In the .pro file of the application I have

    #-------------------------------------------------
    #
    # Project created by QtCreator 2012-06-06T13:21:53
    #
    #-------------------------------------------------
    
    QT += core gui
    QT += widgets
    
    
    TARGET = libusb_Demo
    TEMPLATE = app
    
    
    
    
    SOURCES += main.cpp\
            mainwindow.cpp \
        usbcomm.cpp
    
    HEADERS  += mainwindow.h \
        usbcomm.h
    
    FORMS    += mainwindow.ui
    
    
    #-------------------------------------------------
    # Add LibUSB library
    #-------------------------------------------------
    LIBS += -L.\ -llibusb-1.0
    
    #-------------------------------------------------
    # Make sure to add the required libraries or
    # frameoworks for the demo work depending on
    # what OS is being used
    #-------------------------------------------------
    macx: LIBS += -framework CoreFoundation
    win32: LIBS += -lSetupAPI
    
    #-------------------------------------------------
    # Make sure output directory for object file and
    # executable is in the correct subdirectory
    #-------------------------------------------------
    macx {
        DESTDIR = mac
        OBJECTS_DIR = mac
        MOC_DIR = mac
        UI_DIR = mac
        RCC_DIR = mac
    }
    unix: !macx {
        DESTDIR = linux
        OBJECTS_DIR = linux
        MOC_DIR = linux
        UI_DIR = linux
        RCC_DIR = linux
    }
    win32 {
        DESTDIR = windows
        OBJECTS_DIR = windows
        MOC_DIR = windows
        UI_DIR = windows
        RCC_DIR = windows
    }
    
    OTHER_FILES +=
    
    win32: LIBS += -L$$PWD/ -llibusb-1.0
    
    INCLUDEPATH += $$PWD/
    DEPENDPATH += $$PWD/
    
    

    and in the README file I read

    This is a cross platform project that is similar in functionality as the
    "plug_and_play_example\src\vc++2008_express" project.  However, 
    this version is developed in the Qt 5.x.x development environment (from www.qt.org), 
    and uses the "libusb v1.0.x" APIs.
    
    The libusb v1.0.x "driver" provides top level libusb API functions for accessing 
    the USB device, but uses the Microsoft WinUSB driver when the application is 
    used on the Windows platform.  Therefore, when this project is built and run 
    on a Windows based machine, install and use the standard WinUSB driver package 
    that comes with this demo, even when using this libusb application project.
    
    The libusb-1.0.dll file and respective .lib file provided here are based on 
    the libusb v1.0.19 source.  See www.libusb.org for details on the libusb APIs 
    and links to the latest libusb source code and header download.
    
    If using this project to build a Linux or Mac OS X executable, make sure
    that the libusb v1.0.19 driver is available and installed correctly.
    

    What's the problem here?

    aha_1980A 1 Reply Last reply
    0
    • A Andrew23

      I'm working to manage the USB communication between a Qt application and a PIC32 microcontroller device seen as a vendor class device. In the Microchip forum they suggested me to start from one application example written in Qt5 within their MLA library pakage. But now I'm trying to run the example but I get the following errorrs:

      :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.lib when searching for -llibusb-1.0
      :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.dll when searching for -llibusb-1.0
      :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.lib when searching for -llibusb-1.0
      :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src/libusb-1.0.dll when searching for -llibusb-1.0
      :-1: error: skipping incompatible C:\Microchip\mla\v2018_11_26\apps\usb\device\vendor_basic\utilities\libusb_cross_platform_example\src\libusb-1.0.lib when searching for -llibusb-1.0
      :-1: error: cannot find -llibusb-1.0
      :-1: error: collect2.exe: error: ld returned 1 exit status
      :-1: error: [Makefile.Debug:78: windows/libusb_Demo.exe] Error 1
      

      In the .pro file of the application I have

      #-------------------------------------------------
      #
      # Project created by QtCreator 2012-06-06T13:21:53
      #
      #-------------------------------------------------
      
      QT += core gui
      QT += widgets
      
      
      TARGET = libusb_Demo
      TEMPLATE = app
      
      
      
      
      SOURCES += main.cpp\
              mainwindow.cpp \
          usbcomm.cpp
      
      HEADERS  += mainwindow.h \
          usbcomm.h
      
      FORMS    += mainwindow.ui
      
      
      #-------------------------------------------------
      # Add LibUSB library
      #-------------------------------------------------
      LIBS += -L.\ -llibusb-1.0
      
      #-------------------------------------------------
      # Make sure to add the required libraries or
      # frameoworks for the demo work depending on
      # what OS is being used
      #-------------------------------------------------
      macx: LIBS += -framework CoreFoundation
      win32: LIBS += -lSetupAPI
      
      #-------------------------------------------------
      # Make sure output directory for object file and
      # executable is in the correct subdirectory
      #-------------------------------------------------
      macx {
          DESTDIR = mac
          OBJECTS_DIR = mac
          MOC_DIR = mac
          UI_DIR = mac
          RCC_DIR = mac
      }
      unix: !macx {
          DESTDIR = linux
          OBJECTS_DIR = linux
          MOC_DIR = linux
          UI_DIR = linux
          RCC_DIR = linux
      }
      win32 {
          DESTDIR = windows
          OBJECTS_DIR = windows
          MOC_DIR = windows
          UI_DIR = windows
          RCC_DIR = windows
      }
      
      OTHER_FILES +=
      
      win32: LIBS += -L$$PWD/ -llibusb-1.0
      
      INCLUDEPATH += $$PWD/
      DEPENDPATH += $$PWD/
      
      

      and in the README file I read

      This is a cross platform project that is similar in functionality as the
      "plug_and_play_example\src\vc++2008_express" project.  However, 
      this version is developed in the Qt 5.x.x development environment (from www.qt.org), 
      and uses the "libusb v1.0.x" APIs.
      
      The libusb v1.0.x "driver" provides top level libusb API functions for accessing 
      the USB device, but uses the Microsoft WinUSB driver when the application is 
      used on the Windows platform.  Therefore, when this project is built and run 
      on a Windows based machine, install and use the standard WinUSB driver package 
      that comes with this demo, even when using this libusb application project.
      
      The libusb-1.0.dll file and respective .lib file provided here are based on 
      the libusb v1.0.19 source.  See www.libusb.org for details on the libusb APIs 
      and links to the latest libusb source code and header download.
      
      If using this project to build a Linux or Mac OS X executable, make sure
      that the libusb v1.0.19 driver is available and installed correctly.
      

      What's the problem here?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @Andrew23,

      • which compiler are you using?
      • which architecture (32/64 bit?)

      Regards

      Qt has to stay free or it will die.

      A 1 Reply Last reply
      0
      • aha_1980A aha_1980

        Hi @Andrew23,

        • which compiler are you using?
        • which architecture (32/64 bit?)

        Regards

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

        @aha_1980
        compiler: MinGW 8.1.0 64-bit for C++
        architecture: 64-bit

        jsulmJ 1 Reply Last reply
        0
        • A Andrew23

          @aha_1980
          compiler: MinGW 8.1.0 64-bit for C++
          architecture: 64-bit

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

          @Andrew23 You should check whether this libusb-1.0 is also 64bit and which compiler was used to build it.

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

          A 1 Reply Last reply
          3
          • jsulmJ jsulm

            @Andrew23 You should check whether this libusb-1.0 is also 64bit and which compiler was used to build it.

            A Offline
            A Offline
            Andrew23
            wrote on last edited by
            #5

            @jsulm Yes the problem was the 32-bit libusb library. I overwite it with the 64-bit version and it works. Thanks.

            Now I'd like to know how to modify the project's settings to automatically choose the correct library. My .pro file is the following

            #-------------------------------------------------
            #
            # Project created by QtCreator 2012-06-06T13:21:53
            #
            #-------------------------------------------------
            
            QT += core gui
            QT += widgets
            
            TARGET = libusb_Demo
            TEMPLATE = app
            
            SOURCES += main.cpp\
                    mainwindow.cpp \
                usbcomm.cpp
            
            HEADERS  += mainwindow.h \
                usbcomm.h
            
            FORMS    += mainwindow.ui
            
            #-------------------------------------------------
            # Add LibUSB library
            #-------------------------------------------------
            LIBS += -L.\ -llibusb-1.0
            
            #-------------------------------------------------
            # Make sure to add the required libraries or
            # frameoworks for the demo work depending on
            # what OS is being used
            #-------------------------------------------------
            macx: LIBS += -framework CoreFoundation
            win32: LIBS += -lSetupAPI
            
            #-------------------------------------------------
            # Make sure output directory for object file and
            # executable is in the correct subdirectory
            #-------------------------------------------------
            macx {
                DESTDIR = mac
                OBJECTS_DIR = mac
                MOC_DIR = mac
                UI_DIR = mac
                RCC_DIR = mac
            }
            unix: !macx {
                DESTDIR = linux
                OBJECTS_DIR = linux
                MOC_DIR = linux
                UI_DIR = linux
                RCC_DIR = linux
            }
            win32 {
                DESTDIR = windows
                OBJECTS_DIR = windows
                MOC_DIR = windows
                UI_DIR = windows
                RCC_DIR = windows
            }
            
            OTHER_FILES +=
            
            win32: LIBS += -L$$PWD/ -llibusb-1.0
            
            INCLUDEPATH += $$PWD/
            DEPENDPATH += $$PWD/
            

            Do you have any suggestion or documentation about the .pro file customization?

            aha_1980A 1 Reply Last reply
            0
            • A Andrew23

              @jsulm Yes the problem was the 32-bit libusb library. I overwite it with the 64-bit version and it works. Thanks.

              Now I'd like to know how to modify the project's settings to automatically choose the correct library. My .pro file is the following

              #-------------------------------------------------
              #
              # Project created by QtCreator 2012-06-06T13:21:53
              #
              #-------------------------------------------------
              
              QT += core gui
              QT += widgets
              
              TARGET = libusb_Demo
              TEMPLATE = app
              
              SOURCES += main.cpp\
                      mainwindow.cpp \
                  usbcomm.cpp
              
              HEADERS  += mainwindow.h \
                  usbcomm.h
              
              FORMS    += mainwindow.ui
              
              #-------------------------------------------------
              # Add LibUSB library
              #-------------------------------------------------
              LIBS += -L.\ -llibusb-1.0
              
              #-------------------------------------------------
              # Make sure to add the required libraries or
              # frameoworks for the demo work depending on
              # what OS is being used
              #-------------------------------------------------
              macx: LIBS += -framework CoreFoundation
              win32: LIBS += -lSetupAPI
              
              #-------------------------------------------------
              # Make sure output directory for object file and
              # executable is in the correct subdirectory
              #-------------------------------------------------
              macx {
                  DESTDIR = mac
                  OBJECTS_DIR = mac
                  MOC_DIR = mac
                  UI_DIR = mac
                  RCC_DIR = mac
              }
              unix: !macx {
                  DESTDIR = linux
                  OBJECTS_DIR = linux
                  MOC_DIR = linux
                  UI_DIR = linux
                  RCC_DIR = linux
              }
              win32 {
                  DESTDIR = windows
                  OBJECTS_DIR = windows
                  MOC_DIR = windows
                  UI_DIR = windows
                  RCC_DIR = windows
              }
              
              OTHER_FILES +=
              
              win32: LIBS += -L$$PWD/ -llibusb-1.0
              
              INCLUDEPATH += $$PWD/
              DEPENDPATH += $$PWD/
              

              Do you have any suggestion or documentation about the .pro file customization?

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi @Andrew23,

              I have the following in one of my projects:

              *-msvc* {
                contains(QMAKE_TARGET.arch, x86_64) {
                  # MSVC 64 bit
                  LIBS += -L$$PWD/ni4882 -lni4882-64
                } else {
                  # MSVC 64 bit
                  LIBS += -L$$PWD/ni4882 -lni4882-32
                }
              } else {
                # MinGW 32 bit
                LIBS += -L$$PWD/ni4882 -lgpib-32
              }
              

              By the way:

              LIBS += -L.\ -llibusb-1.0

              You are aware that there is already an entry win32: LIBS += -L$$PWD/ -llibusb-1.0 more below in your .pro file? $$PWD refers to the source directory during compilation, btw.

              I hope that helps,

              Regards

              Qt has to stay free or it will die.

              1 Reply Last reply
              1

              • Login

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