LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 02-14-2006, 05:45 AM   #1
hazeposse
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:

usb_init();
for ( usb_bus = usb_busses; usb_bus; usb_bus = usb_bus->next )
{
usb_find_busses();
usb_find_devices();

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, 04:22 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
Code:
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).
 
  


Reply


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 05:38 AM
help me --- interrupt_read() in libusb shiva_teknic Programming 0 09-27-2005 09:17 AM
error while loading shared libraries: libusb-0.1.4 Ross Clement Fedora 2 11-10-2004 11:53 AM
compile error: #error unknown processor family kmack2001 Linux - Newbie 0 02-14-2004 12:52 PM
libUSB install Dutch3 Linux - Newbie 1 04-30-2002 08:15 AM


All times are GMT -5. The time now is 07:25 PM.

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