Can't run libusb on windows QT

684 Views Asked by At

Development evnironment: Qt Creator 4.0.2 Основан на Qt 5.7.0 (MSVC 2013, 32 бита)

Operating system: WIndows 7 x64

Error: :-1: ошибка: No rule to make target 'libusb-win32-bin-1.2.6.0/lib/gcc/libusb.a', needed by 'debug\TestUsb.exe'. Stop.

I want to use libusb in my project. I download and unzip libusb-win32-bin-1.2.6.0 in project folder. Then i modify project file:

LIBS += libusb-win32-bin-1.2.6.0/lib/gcc/libusb.a
INCLUDEPATH += libusb-win32-bin-1.2.6.0/include
DEPENDPATH += libusb-win32-bin-1.2.6.0/include
PRE_TARGETDEPS += libusb-win32-bin-1.2.6.0/lib/gcc/libusb.a

And this is my main.c file:

#include <iostream>
#include <lusb0_usb.h>

int main(int argc, char *argv[])
{
    usb_dev_handle *USB_Device = NULL;
    struct usb_bus *usbBus;
    struct usb_device *usbDevice;

    for (usbBus = usb_get_busses(); usbBus; usbBus = usbBus->next)
      {
          for (usbDevice = usbBus->devices; usbDevice; usbDevice = usbDevice->next)
          {
              pfintf("0x%h 0x%h", usbDevice->descriptor.idVendor, usbDevice->descriptor.idProduct);
              if ((usbDevice->descriptor.idVendor == 0x0483) && (usbDevice->descriptor.idProduct == 0x5750))
              {
                  USB_Device = usb_open(usbDevice);
              }
          }
      }

    printf("Hello world");
}

I don't know whats wrong. I can't find any solution in internet.

0

There are 0 best solutions below