LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   libusb compiler error, Help!!! (https://www.linuxquestions.org/questions/programming-9/libusb-compiler-error-help-423481/)

Librason 03-10-2006 07:45 AM

libusb compiler error, Help!!!
 
i test a .c file as follows:

#include <usb.h>
#include <stdio.h>

#define VENDOR_ID 0xE461
#define PRODUCT_ID 0x0007

usb_dev_handle *open_dev(void) {
struct usb_bus *busses;
struct usb_bus *bus;
struct usb_device *dev;

/* Find the device */
usb_init();
usb_find_busses();
usb_find_devices();
busses = usb_get_busses();

for (bus=busses; bus; bus=bus->next) {
for (dev=bus->devices; dev; dev=dev->next) {
if (dev->descriptor.idVendor == VENDOR_ID &&
dev->descriptor.idProduct == PRODUCT_ID) {
return usb_open(dev);
}
}
}
printf("No device found\n");
return NULL;
}

int main(int argc, char **argv) {
usb_dev_handle *d;
int i;

if (!(d = open_dev())) {
printf("Error opening device\n");
return 1;
}
else
{
printf("VendorID = %04X; ProductID = %04X\n",
d->device->descriptor.idVendor, d->device->descriptor.idProduct);

}
...
return (0);
}

when i compile it, i have a error:
dereferencing pointer to incomplete type

I don't know where is the mistake.

jtshaw 03-10-2006 09:46 PM

Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.


All times are GMT -5. The time now is 06:13 PM.