# /home/username/toolschain/4.4.3/bin/arm-linux-gcc -static -o a.out usb2ram.c -I/usr/include -lm -lusb-1.0
/tmp/ccQa2wq4.o: In function `find_qt2410_device':
usb2ram.c: (.text+0x1f0): undefined reference to `usb_busses'
/tmp/ccQa2wq4.o: In function `qt2410_send_file':
usb2ram.c: (.text+0x4ac): undefined reference to `usb_bulk_write'
/tmp/ccQa2wq4.o: In function `main':
usb2ram.c: (.text+0x710): undefined reference to `usb_init'
usb2ram.c: (.text+0x714): undefined reference to `usb_find_busses'
usb2ram.c: (.text+0x72c): undefined reference to `usb_find_devices'
usb2ram.c: (.text+0x7c: undefined reference to `usb_open'
usb2ram.c: (.text+0x7ec): undefined reference to `usb_strerror'
usb2ram.c: (.text+0x81: undefined reference to `usb_claim_interface'
usb2ram.c: (.text+0x82c): undefined reference to `usb_strerror'
collect2: ld returned 1 exit status
# /home/username/arm-kernel/toolschain/4.4.3/bin/arm-linux-gcc -o a.out usb2ram.c -I/usr/include -lm -lusb-1.0
/tmp/ccAHTRjz.o: In function `find_qt2410_device':
usb2ram.c: (.text+0x1f0): undefined reference to `usb_busses'
/tmp/ccAHTRjz.o: In function `qt2410_send_file':
usb2ram.c: (.text+0x4ac): undefined reference to `usb_bulk_write'
/tmp/ccAHTRjz.o: In function `main':
usb2ram.c: (.text+0x710): undefined reference to `usb_init'
usb2ram.c: (.text+0x714): undefined reference to `usb_find_busses'
usb2ram.c: (.text+0x72c): undefined reference to `usb_find_devices'
usb2ram.c: (.text+0x7c: undefined reference to `usb_open'
usb2ram.c: (.text+0x7ec): undefined reference to `usb_strerror'
usb2ram.c: (.text+0x81: undefined reference to `usb_claim_interface'
usb2ram.c: (.text+0x82c): undefined reference to `usb_strerror'
collect2: ld returned 1 exit status
出錯(cuò)信息一樣一樣兒的。。。。
從出錯(cuò)信息推斷,肯定找到對(duì)應(yīng)的庫(kù)文件了,但是就是找不到函數(shù)。我查看了庫(kù)文件:
$ file libusb-1.0.a libusb-1.0.so.0.1.0
libusb-1.0.a: current ar archive
libusb-1.0.so.0.1.0: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped