Compiling against libusb-dev on Ubuntu

后端 未结 2 1875
一向
一向 2021-02-15 14:10

I am trying to compile the example libusb.c provided by libusb package (if you dl the source code.)

It doesn\'t work to say the least.

#include 

        
相关标签:
2条回答
  • 2021-02-15 14:36

    Just en explanation why your attempt to replace libusb/libusb.h with usb.h fails: usb.h is a header from linux-headers, not from libusb-dev. You need #include <libusb.h> instead.

    0 讨论(0)
  • 2021-02-15 14:50

    This is what I had to do on Debian. It should be at least similar in Ubuntu.

    Install libusb-1.0-0-dev

    Instead of:

    #include <libusb/libusb.h>
    

    do:

    #include <libusb.h>
    

    Compile with:

    gcc example.c `pkg-config --libs --cflags libusb-1.0`
    
    0 讨论(0)
提交回复
热议问题