2024-06-26 03:01 AM - edited 2024-06-26 03:02 AM
Hey ST Community,
I started getting errors within STM32CubeIDE, throughout all workbenches randomly, after working on a new project.
The errors involve uint16_t, such as:
-'error: unknown type name "uint16_t''
-"error: unknown type name 'uint16_t'; did you mean 'int16_t'?' etc"
-"error: 'uint16_t' undeclared (first use in this function); did you mean 'int16_t'?"
Seems like the errors are within the CMSIS and STM32H7xx_HAL_Driver files. For example, adding '#include <stdint.h>' to 'stm32h7xx_hal_gpio.h', does not seem to fix the errors as suggested by similar problems encountered in the STM community.
I am wondering if this is a compiler or driver issue within STM32.
Before working on the new project, I had no Build/compile issues. Reverting the project to a previous version which did build with no errors did not fix it.
Thank you for any suggestions that will fix this.
Solved! Go to Solution.
2024-06-27 02:07 AM
I reinstalled the program and it fixed the problem, so definitely was an environmental problem.
stdint.h must have been damaged as you suggested.
Thanks for the suggestions and the support.
2024-06-26 03:45 AM
@AEng7 wrote:The errors involve uint16_t, such as:
-'error: unknown type name "uint16_t''
-"error: unknown type name 'uint16_t'; did you mean 'int16_t'?' etc"
-"error: 'uint16_t' undeclared (first use in this function); did you mean 'int16_t'?"
They certainly suggest that #include <stdint.h> is missing.
Try adding #include <stdint.h> as the very first #include - before everything else ...
2024-06-26 04:09 AM
Thanks for the suggestion Andrew - this didn't work unfortunately
2024-06-26 04:24 AM
Even if you put the #include <stdint.h> as the very first #include - before everything else in your .c file(s)?
2024-06-26 05:18 AM
I will try doing that in all the .cpp files and see if that works thanks
2024-06-26 05:19 AM
I have tried it will all the STM driver files that are now bringing up errors and didn't fix it.
2024-06-26 06:01 AM
> For example, adding '#include <stdint.h>' to 'stm32h7xx_hal_gpio.h',
Normally the ST library header files and CMSIS pull in stdint.h properly, so these errors should never occur.
Something is bad in your environment, stdint,h is damaged, CubeIDE is installed in path containing weird characters...
* Import some small example for your MCU/board (using the CubeIDE import example tool) and build it.
* Install CubeIDE on a clean machine with supported OS (not Windows 7 or exotic Linux version)
2024-06-27 02:07 AM
I reinstalled the program and it fixed the problem, so definitely was an environmental problem.
stdint.h must have been damaged as you suggested.
Thanks for the suggestions and the support.