Cube IDE : Error: unknown type name 'HAL_StatusTypeDef'
I just got the same issue but with an STM32F407 microcontroller. Suddently, the build broke and there were 102 errors saying that HAL_StatusTypeDef was unknown. I followed the path to all the includes, and what I saw is that &quot;stm32f4xx_hal_def.h&quot; includes &quot;stm32f4xx.h&quot;, which indirectly re-includes &quot;stm32f4xx_hal_def.h&quot; for each device you have enabled in &quot;stm32f4xx_hal_conf.h&quot;. Except that each include of &quot;stm32f4xx_hal_conf.h&quot; includes again &quot;stm32f4xx_hal_def.h&quot;, but this will fail, as the #define __STM32F4xx_HAL_DEF guards the file of being included twice !
So the conclusion for me was to always include &quot;stm32f4xx.h&quot;, and not any intermediate file, as all these circular includes are calling for trouble !