I am afraid to tell that I am not able to use the libusb.h since it is
not getting linked with the code..
I get below compilation errors:
usb_test.c:(.text+0x17): undefined reference to `usb_find_busses'
usb_test.c:(.text+0x1c): undefined reference to `usb_find_devices'
Please help me with the steps to install and use the libusb.h
From: Peter Stuge <peter@st...> - 2012-04-19 00:55:30
> I am afraid to tell that I am not able to use the libusb.h since it
> is not getting linked with the code..
libusb.h is not needed during linking, only during compilation.
> I get below compilation errors:
> usb_test.c:(.text+0x17): undefined reference to `usb_find_busses'
> usb_test.c:(.text+0x1c): undefined reference to `usb_find_devices'
> Please help me with the steps to install and use the libusb.h
The above function names are part of the deprecated libusb-0.1 API
and are defined in usb.h which libusb-0.1 provides.
libusb.h is part of the libusb-1.0 package, where all function names
begin with libusb_ instead of usb_.
I strongly recommend that you move your application to use the
libusb-1.0 API instead.
How to install libusb-1.0 is unfortunately nothing we can help with,
because it is completely system dependent and while we know libusb we
don't know your system. Please talk to your systems administrator or
a nearby friend who can help you out.
As for using libusb-1.0, it is strongly recommended to use pkg-config
in order to find the correct compiler and linker flags for your
gcc $(shell pkg-config --cflags libusb-1.0) -c project.c
gcc $(shell pkg-config --libs libusb-1.0) -o project project.o
This is only an illustration to show how you should use pkg-config.
If you're not using a GNU toolchain you naturally have to adapt the
If you're using Windows you should be able to use one of the numerous
toolchain project files.