Loading...
 

STM32MP1 support available in SW4STM32

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world.
And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4; you can download a short video showcasing this on the ac6-tools website (registration required).

System Workbench for STM32


Unknown Type Name error

My code is getting a Unknown Type Name error even though the code file is including a header file that has the type definition in it. The error is in a .h file. It includes another .h file that includes another that has the definition.

I’ve been trying to figure out what is going on with no luck. The definition is a couple of .h files deep but that should not be a problem should it? I turned on verbose hoping to get more info about the problem but no luck there either.

Any help would be appreciated.

++CODE++


from usbh_MIDI.h

  1. include “usbh_core.h”

..
..
extern USBH_ClassTypeDef MIDI_Class; (line with error)

From usbh_core.h:

  1. include “usbh_def.h”


From usbh_def.h:
/* USB Host Class structure */
typedef struct
{
const char *Name;
uint8_t ClassCode;
USBH_StatusTypeDef (*Init) (struct _USBH_HandleTypeDef *phost);
USBH_StatusTypeDef (*DeInit) (struct _USBH_HandleTypeDef *phost);
USBH_StatusTypeDef (*Requests) (struct _USBH_HandleTypeDef *phost);
USBH_StatusTypeDef (*BgndProcess) (struct _USBH_HandleTypeDef *phost);
USBH_StatusTypeDef (*SOFProcess) (struct _USBH_HandleTypeDef *phost);
void* pData;
} USBH_ClassTypeDef;

France

Hi Tim,

Is it possible that, directly or indirectly, usbh_def.h includes usbh_MIDI.h before defining USBH_ClassTypeDef, or usbh_core.h includes usbh_MIDI.h (again possibly indirectly) before including usbh_def.h ?

This kind of problem usually comes from incorrect cross-references between header files: as they are all protected by a “single include #ifdef” when an included file tries to include the file that includes it, this does nothing so only the definitions located before the recursive inclusion are visible...

Hope this helps,

Bernard (Ac6)

PS: You could try to add the -E flag to your compile line: instead of compiling your file, it will generate the preprocessed source code, with all includes “flattened” so you should understand why it does not work as expected.

Hi Bernard, thanks for the response. I didn’t about cross referencing. This source is a bit of a patchwork mess. I am trying to compile someone else’s code but I think it used a different tool. The errors I get make no sense. I compiled once with -E on the preprocessor and got more strangeness, but I just did it again and got no errors.

Not all the header files have the “single include #ifdef” on them. Is it your take that they all should?

Thanks again!


Correction: I just checked, the header files all have the “single include #ifdef” code.

The only way I can explain what I am seeing is that the compiler is confused by something. Not a great place to be.

--timr