开发环境: Qt Creator 4.0.2 Основан на Qt 5.7.0 (MSVC 2013, 32 бита)
操作系统: Windows 7 x64
错误:
:-1: ошибка: No rule to make target 'libusb-win32-bin-1.2.6.0/lib/gcc/libusb.a', needed by 'debug\TestUsb.exe'. Stop.
我想在我的项目中使用 libusb。libusb-win32-bin-1.2.6.0
我在项目文件夹中下载并解压缩。然后我修改项目文件:
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
这是我的main.c
文件:
#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");
}
我不知道怎么了。我在互联网上找不到任何解决方案。