PDA

View Full Version : Libusb



CodeFreak
27th July 2018, 21:12
Hi everyone,
I tried to execute "testlibusb.c" but following error occurred:

:-1: error: No rule to make target '.../LIBUSBTEST/LIBUSB/MinGW32/static/liblibusb-1.0d.a', needed by 'debug\LIBUSBTEST.exe'. Stop.

I added "libusb.h" by right click on project name and 'add existing files'
and also "libusb-1.0.a" by right click on project name and 'add library' (static library).



HEADERS += \
libusb.h

SOURCES += \
testlibusb.c

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/LIBUSB/MinGW32/static/ -llibusb-1.0
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/LIBUSB/MinGW32/static/ -llibusb-1.0d

INCLUDEPATH += $$PWD/LIBUSB/MinGW32/static
DEPENDPATH += $$PWD/LIBUSB/MinGW32/static

win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/LIBUSB/MinGW32/static/liblibusb-1.0.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/LIBUSB/MinGW32/static/liblibusb-1.0d.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/LIBUSB/MinGW32/static/libusb-1.0.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/LIBUSB/MinGW32/static/libusb-1.0d.lib


I do not have any idea what should I do.

CodeFreak
28th July 2018, 19:21
Does another library exist which can be used in Qt?

CodeFreak
29th July 2018, 12:10
After few modification following errors occurred:

12906

d_stranz
29th July 2018, 19:25
It looks to me as though you are trying to link to an incompatible version of libusb. It could be incompatible for any number of reasons:

- it was built with a different compiler,
- it was built for a different OS (Windows uses .lib / .dll for libraries, not .lib / .a)
- it was built as debug or release and you are specifying the wrong one to release or debug
- you are trying to link as static to a DLL
- you are using a preprocessor #define that is telling the compiler you will be linking to a DLL when you actually aren't

If you haven't built this libusb yourself, then I would guess it is almost certainly an incompatibility between the library you have and the toolchain you are using to build your app.

CodeFreak
29th July 2018, 20:22
Thanks for your reply.