Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-14-2006, 04:45 AM   #1
LQ Newbie
Registered: Dec 2005
Posts: 7

Rep: Reputation: 0
compile error libusb

hello i want to compile a C-file that call this functions:

for ( usb_bus = usb_busses; usb_bus; usb_bus = usb_bus->next )

i'm using this to compile:
usbtest.o: usbtest.c
gcc -c usbtest.c
usbtest: usbtest.o
gcc -o -lusb usbtest usbtest.o
(i tried also:
gcc -Wall -W usbtest.c -o usbtest -L/usr/lib/ -lusb)

but i have a lot of errors:

root@pcg10203:~/usb# make usbtest
gcc -c usbtest.c
usbtest.c:116:3: warning: no newline at end of file
gcc -o usbtest usbtest.o
usbtest.o(.text+0x7): In function `device_init':
: undefined reference to `usb_find_busses'
usbtest.o(.text+0xc): In function `device_init':
: undefined reference to `usb_find_devices'
usbtest.o(.text+0x11): In function `device_init':
: undefined reference to `usb_busses'
usbtest.o(.text+0x88): In function `test_usb':
: undefined reference to `usb_open'
usbtest.o(.text+0xc7): In function `test_usb':
: undefined reference to `usb_get_string_simple'
usbtest.o(.text+0x131): In function `test_usb':
: undefined reference to `usb_get_string_simple'
usbtest.o(.text+0x19b): In function `test_usb':
: undefined reference to `usb_get_string_simple'
usbtest.o(.text+0x1e1): In function `test_usb':
: undefined reference to `usb_close'
usbtest.o(.text+0x1fb): In function `main':
: undefined reference to `usb_init'
collect2: ld returned 1 exit status
make: *** [usbtest] Error 1

i don't know where the real problem is, but i do know that we have to use -lusb but don't know how.
Can someone help me??
Old 02-14-2006, 03:22 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,571

Rep: Reputation: 180Reputation: 180
gcc -o usbtest usbtest.o -lusb
Try this. You may need -L, through, if libusb is not in standard library directories (if it's in /usr/lib, you don't need it).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
libusb compile error gabyx Programming 10 03-24-2010 04:38 AM
help me --- interrupt_read() in libusb shiva_teknic Programming 0 09-27-2005 08:17 AM
error while loading shared libraries: libusb-0.1.4 Ross Clement Fedora 2 11-10-2004 10:53 AM
compile error: #error unknown processor family kmack2001 Linux - Newbie 0 02-14-2004 11:52 AM
libUSB install Dutch3 Linux - Newbie 1 04-30-2002 07:15 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration