Skip to main content
Senior
June 26, 2024
Solved

Uint16_t Build Errors within STM32CubeIDE 12.1

  • June 26, 2024
  • 7 replies
  • 6890 views

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. 

 

 

    This topic has been closed for replies.
    Best answer by AEng7

    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. 

    7 replies

    Andrew Neil
    Super User
    June 26, 2024

    @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 ...

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    AEng7Author
    Senior
    June 26, 2024

    Thanks for the suggestion Andrew - this didn't work unfortunately 

     

    Andrew Neil
    Super User
    June 26, 2024

    Even if you put the   #include <stdint.h>  as the very first  #include - before everything else in your .c file(s)?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    AEng7Author
    Senior
    June 26, 2024

    I will try doing that in all the .cpp files and see if that works thanks

    AEng7Author
    Senior
    June 26, 2024

    I have tried it will all the STM driver files that are now bringing up errors and didn't fix it.

    Pavel A.
    June 26, 2024

     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)

    AEng7AuthorBest answer
    Senior
    June 27, 2024

    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.