• Home
  • Help
  • Search
  • Login
  • Register
  Show Posts
Pages: [1]
1  Linux Stuff / Linux distributions / Re: Problem with libusb-1.0 plug on: December 24, 2009, 05:28:40 AM
Thank you, Mark.  This helped.

I also found that I could take care of the first problem (can't find libusb.h) by changing my include list from:

#include <libusb.h>

to

#include <libusb-1.0/libusb.h>

Easy enough.  I didn't know about the -I feature of gcc, so thanks for that. Smiley

Reed
2  Linux Stuff / Linux distributions / Re: Problem with libusb-1.0 plug on: December 23, 2009, 07:56:54 PM
Thanks very much, birdman.  That helped get past that problem, almost.  After I brought in the -dev files, gcc could not fine libusb.h, even though it was located in /usr/include/libusb-1.0/libusb.h.  I was able to get around that problem by simply moving this file to /usr/include/libusb.h.  I don't understand why, but it worked.  Next, the compiler was happy, but the linker complained:

/tmp/cc0M1IR3.o: In function `main':
FirstUsb.c:(.text+0x1a8): undefined reference to `libusb_init'
FirstUsb.c:(.text+0x1f0): undefined reference to `libusb_set_debug'
FirstUsb.c:(.text+0x208): undefined reference to `libusb_get_device_list'
FirstUsb.c:(.text+0x260): undefined reference to `libusb_get_device_descriptor'
FirstUsb.c:(.text+0x320): undefined reference to `libusb_open'
FirstUsb.c:(.text+0x370): undefined reference to `libusb_kernel_driver_active'
...
FirstUsb.c:(.text+0x940): undefined reference to `libusb_free_device_list'
FirstUsb.c:(.text+0x950): undefined reference to `libusb_close'
FirstUsb.c:(.text+0x958): undefined reference to `libusb_exit'
collect2: ld returned 1 exit status

This problem was cured by changing the gcc invocation line from:

gcc FirstUsb.c  -lusb-1.0 -lm

to:

gcc FirstUsb.c  -L/lib/libusb-1.0.so.0 -lusb-1.0 -lm

I'd like to understand why I had to be so explicit about these two files, but for now the program compiled, linked, and seems to be working.

Thank you for your help, and my best wishes to all for a wonderful holiday--

Reed
3  Linux Stuff / Linux distributions / Problem with libusb-1.0 plug on: December 22, 2009, 04:03:22 PM
Hi Everyone

I'm newbie to Linux, plug computers, but I'm totally sold on the plug.  I've been doing computer-based product development for a couple of decands, and I think the plug is a great idea with a future.

I'm porting an application from another Linux computer (Atom processor, Ubuntu 9.04).  My application talks to a Cypress chip over USB.  Right now it collects temperature information from a thermistor, but now that I know how to communicate from the Cypress to Linux, there will be more applications to come.  Linking on the Atom was no problem, but when I use this simple command line:

gcc Usbprogram.c -lusb-1.0 -lm (simplified from the Makefile)

I get:

/usr/bin/ld: cannot find -lusb-1.0

I got the same type of response when I tried to compile the libusb-0.1 program shown elsewhere on this forum.  I installed both libusb-1.0 and 0.1 using apt-get install.  Both have shared object links, but both give this same error.  I'm sure I'm missing something simple, but I can't figure it out.

I'm stuck, and I would appreciate any help you can offer.  Thank you!

Reed
Pages: [1]