AnsweredAssumed Answered

Very strange compiler error

Question asked by Omkar Karmalkar on Feb 23, 2017
Latest reply on Feb 28, 2017 by Daniel Chen

Hello NXP community,

I have a very strange compiler error when I try to compile an example code for USB keyboard device application that I got from Freescale MQX. In usb_descriptor.c it has:

`usb_language_t g_usb_language[USB_MAX_SUPPORTED_INTERFACES] ={    {        (uint16_t) 0x0409,        g_string_descriptors,        g_string_desc_size     }};/*************************************/usb_all_languages_t g_languages ={    g_usb_str_0,    sizeof(g_usb_str_0),    USB_MAX_LANGUAGES_SUPPORTED,    g_usb_language};`


uint8_t USB_Desc_Set_Speed(    uint32_t handle,    uint16_t speed     ){    descriptor_union_t ptr1, ptr2;UNUSED_ARGUMENT(handle);'

usb_language_t, usb_all_languages_t & descriptor_union_t are defined in usb_desc.h as follows:

 typedef struct _usb_language {    uint16_t language_id;    uint8_t ** lang_desc;    uint8_t * lang_desc_size;    } usb_language_t;typedef struct _usb_all_languages{    uint8_t *languages_supported_string;    uint8_t  languages_supported_size;    uint8_t  languages_number;    /*Allocate Memory In App Layer*/    usb_language_t *usb_language;} usb_all_languages_t;typedef union descriptor_union{   uint32_t                      word;   uint8_t *                     bufr;   void*                         pntr;   device_descriptor_t         dvic;   usb_configuration_descriptor_t*  cfig;   interface_descriptor_t*      intf;   endpoint_descriptor_t*       ndpt;   qualifier_descriptor_t*      qual;   otg_descriptor_t*            otg;   common_descriptor_t*         common;} descriptor_union_t;

However even after i do #include "usb_desc.h"at start of usb_descriptor.c I get error messages that

Error[Pe020]: identifier "usb_language_t" is undefined

Error[Pe020]: identifier "usb_all_languages_t" is undefined

Error[Pe020]: identifier "descriptor_union_t" is undefined

Can someone please help me out with this?

I am using MQX 4.0.2 RTOS. Also, I am trying to integrate USB keyboard device application (which I found in MQX 4.2.0/usb_v2/examples) in a pre-existing firmware. I am not supposed to upgrade my RTOS to latest MQX version.

Thank you in advance!