Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

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


 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs