【发布时间】:2015-02-17 14:06:14
【问题描述】:
我正在尝试在 Debian (Raspberry Pi Raspbian) 上编译一个 C 程序 ipad_charge (https://github.com/mkorenkov/ipad_charge)。它是为 Ubuntu 编写的,我在那里安装它没有问题。在 Debian 上,我得到编译错误;
gcc -Wall -Wextra ipad_charge.c -lusb-1.0 -o ipad_charge
ipad_charge.c: In function ‘set_charging_mode’:
ipad_charge.c:37:3: warning: implicit declaration of function ‘libusb_strerror’ [-Wimplicit-function-declaration]
ipad_charge.c:37:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
ipad_charge.c:43:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
ipad_charge.c:53:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
ipad_charge.c: In function ‘main’:
ipad_charge.c:152:5: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
/tmp/cc1hdopk.o: In function `set_charging_mode':
ipad_charge.c:(.text+0x6c): undefined reference to `libusb_strerror'
ipad_charge.c:(.text+0xe0): undefined reference to `libusb_strerror'
ipad_charge.c:(.text+0x18c): undefined reference to `libusb_strerror'
/tmp/cc1hdopk.o: In function `main':
ipad_charge.c:(.text+0x5fc): undefined reference to `libusb_strerror'
collect2: ld returned 1 exit status
Makefile:2: recipe for target 'ipad_charge' failed
make: *** [ipad_charge] Error 1
当我查看代码时,似乎 libusb 正在做繁重的工作。我的猜测是我需要运行更新版本的 libusb 才能在 Debian 上编译。由于我想继续使用 Debian stable,有人知道我如何在 Debian 中安装更新版本的 libusb 以便我可以让这个程序工作吗?我是否正确理解了这个问题,还是有其他问题?
【问题讨论】:
标签: c linux ubuntu debian raspberry-pi