No matter what I run I get,
./main.c:1:10: fatal error: libusb.h: No such file or directory
#include "libusb.h"
^~~~~~~~~~
compilation terminated.
Things tried
gcc ./main.c -l/usr/include/libusb-1.0/
gcc ./main.c -l/usr/include/
gcc ./main.c -L/usr/include/libusb-1.0/
gcc ./main.c -L/usr/include/
If I try
#include "libusb-1.0/libusb.h"
instead of
#include "libusb.h"
It compiles, but I get
/tmp/ccLn3qR2.o: In function `main':
main.c:(.text+0x17): undefined reference to `libusb_init'
main.c:(.text+0x2b): undefined reference to `libusb_open_device_with_vid_pid'
main.c:(.text+0x46): undefined reference to `libusb_release_interface'
main.c:(.text+0x55): undefined reference to `libusb_close'
collect2: error: ld returned 1 exit status
I get the same thing (the above errors) with
gcc ./main.c -I/usr/include/libusb-1.0
I see a lot of people getting similar errors, but I can find the solution. These seem to be documented here.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…