用 aptitude search libusb 可以看到有 libusb-dev 這個 package。
install 後,用 dpkg -L libusb-dev 看一下這個 package 裝了什麼東西:
$dpkg -L libusb-dev
/usr/bin/libusb-config
/usr/include/usb.h
/usr/lib/libusb.a
/usr/lib/libusb.la
/usr/lib/pkgconfig
/usr/lib/pkgconfig/libusb.pc
/usr/lib/libusb.so
可以看到沒有 libusb.h ....libusb.org 有說明 這個相容性問題 http://www.libusb.org/wiki/libusb-1.0#Backwardscompatibility
libusb-1.0 is not backwards compatible with libusb-0.1 - all function names are different, etc. However, libusb-1.0 is designed to be happily installable alongside libusb-0.1 (even in the default configuration) so the lack of backwards compatibility is not really a problem - users can have both libusb versions present on the same system without conflict. That said, there is a libusb-compat-0.1 compatibility layer. This is a "wrapper" which converts libusb-0.1 function calls to their 1.0 equivalents. For more info, see libusb-compat-0.1.所以..要麻 install libusb-0.1 ,不然就要 libusb-compat-0.1。
不然就要改code.
把 code 的 include libusb.h 改 usb.h 試試。
就 OK 了。
從 pkg -L libusb 的 list 可以看到,有提供 libusb-config。
試 run 一下:
$libusb-config
Usage: libusb-config [OPTIONS] [LIBRARIES]
Options:
[--prefix[=DIR]]
[--exec-prefix[=DIR]]
[--version]
[--libs]
[--cflags]
可以知道,就像 libsdl,用 libusb-config --libs , libusb-config --cflags 會列出build 時的 參數。ref : http://www.linuxquestions.org/questions/linux-newbie-8/ubuntu-9-10-include-libusb-libusb-h-802880/
沒有留言:
張貼留言