I have a C program that have #include part in the header.
I have download libusb-1.0.0 to my computer. If I simply copy libusb-1.0.0 folder to the folder where my C program is, it will not work. Therefore, I think I have to somehow install libuse-1.-.- to the folder where my C program is. However, I do not how to install it.
Could anybody please help me. Thanks!
libusb is a C library that provides generic access to USB devices. It is intended to be used by developers to facilitate the production of applications that communicate with USB hardware. It is portable: Using a single cross-platform API, it provides access to USB devices on Linux, macOS, Windows, etc.
To install libusb on Windows 7 download the bin package for libusb-win32 (this link points to version 1.2. 6). Then go to the bin directory and run inf-wizard.exe . Here is where you can customize and generate an INF installation file for your device, as well as the installer executables.
Usually to use the library you need to install the dev version.
Try
sudo apt-get install libusb-1.0-0-dev
This should work:
# apt-get install libusb-1.0-0-dev
First,
sudo apt-get install libusb-1.0-0-dev
updatedb && locate libusb.h.
Second, replace <libusb.h>
with <libusb-1.0/libusb.h>
.
update:
don't need to change any file.just add this to your Makefile.
`pkg-config libusb-1.0 --libs --cflags`
its result is that -I/usr/include/libusb-1.0 -lusb-1.0
Here is what worked for me.
Install the userspace USB programming library development files
sudo apt-get install libusb-1.0-0-dev
sudo updatedb && locate libusb.h
The path should appear as (or similar)
/usr/include/libusb-1.0/libusb.h
Include the header to your C code
#include <libusb-1.0/libusb.h>
Compile your C file
gcc -o example example.c -lusb-1.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With