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?

4 Years
Discussion Span
Last Post by kent.johnstone_1

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[] = {
        // 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.

Edited by kent.johnstone_1: Incomplete

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.