Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

how use libusb functions in Dev-C++

2014-07-03
2014-07-07
  • mehmet unal
    mehmet unal
    2014-07-03

    i install LibUSB-Win32 and trying basic usb program :

    include <stdio.h>

    include <usb.h>

    include <libusb.h>

    int main(void)
    {
    struct usb_bus busses;
    struct usb_bus
    bus;

    usb_init();
    usb_find_busses();
    usb_find_devices();
    
    busses = usb_get_busses();
    for (bus = busses; bus; bus = bus->next) {
        struct usb_device *dev;
        for (dev = bus->devices; dev; dev = dev->next) {
            printf("%04x:%04x\n",
                dev->descriptor.idVendor, dev->descriptor.idProduct);
        }
    }
    return 0;
    

    }

    but i have error messages :
    [Linker error] undefined reference to usb_init' [Linker error] undefined reference tousb_find_busses'
    [Linker error] undefined reference to usb_find_devices' [Linker error] undefined reference tousb_get_busses'

    what can i do?
    thanks . .

     
  • Merak
    Merak
    2014-07-06

    You have to link the right library. If you go to project->options and choose add library ( or something similar, it has been a few years since I used Dev-C ) it should work. The library to add is probably found in where you installed Dev-C under /include. Sorry I seem cryptic but obviously I don't know YOUR system setup. It may be ( for example ) c:/program/Dev-C/mingw32/include... there you'll probably find a file named libusb.o or libusb.a. That's the library to include. Hope this help you at least get started on the search.

     
    • Bonsignore
      Bonsignore
      2014-07-07

      It is documented somewhere installing libusb in windows is HARD
      because it is a LINU/UNI library. I am waiting for the issue to be
      clarified before boggling my head with it.

      On 7/6/14, Merak mehrak@users.sf.net wrote:

      You have to link the right library. If you go to project->options and choose
      add library ( or something similar, it has been a few years since I used
      Dev-C ) it should work. The library to add is probably found in where you
      installed Dev-C under /include. Sorry I seem cryptic but obviously I don't
      know YOUR system setup. It may be ( for example )
      c:/program/Dev-C/mingw32/include... there you'll probably find a file named
      libusb.o or libusb.a. That's the library to include. Hope this help you at
      least get started on the search.


      how use libusb functions in
      Dev-C++


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/dev-cpp/discussion/48211/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      Danilo J Bonsignore