Hello,
I thought when creating a struct, I could call it anything I want. However, in the line:
static struct usb_device_id usbtmc_devices[] = {...
my compiler gives me "unable to resolve identifier 'usb_device_id'". Are struct names supposed to be defined somewhere else?

Recommended Answers

All 2 Replies

Are struct names supposed to be defined somewhere else?

Yes. When you declare a variable that is an instance of usb_device_id, you must first tell the compiler somewhere else what a usb_device_id is. If you have already written a declaration of this struct, we might have to see it so we can further identify the problem.

This is from a Linux program written in the public domain (gnu public license). I am trying to modify it for Microchip processors.

static struct usb_device_id usbtmc_devices[] = {
    {match_flags=USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS,
        // Device class and sub class need to match for notification by the
        // usb core layer.
        BYTE InterfaceClass = 254, // 254 = application specific
        BYTE InterfaceSubClass = 3}, // 3 = test and measurement class (USBTMC)
    { } // Empty (terminating) entry
        };

InterfaceClass and InterfaceSubClass also have errors but that is usually because all assignments following an error have the same error in this compiler.

I did a search and found no place that usb_device_id is defined.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.