Skip to main content
GMeur
Associate III
February 13, 2025
Question

UChar.h is missing

  • February 13, 2025
  • 2 replies
  • 1029 views

Hi,

I just found out <uchar.h> is missing from standard c header files in \STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\include. How am I supposed therefore to use char16_t and char32_t then? Ofc I could just define them myselves but I'd rather work with default library headers tbh. I checked wchar.h and stdint.h to see if those types were defined there with no avail.

I'm quite surprised such a basic header is missing?

Thanks.

 

2 replies

Pavel A.
Super User
February 15, 2025

Indeed uchar.h header is defined for C11 and should be available. But you are the first person who noticed it.

The C library for CubeIDE is originated from RedHat newlib. You can request update from them.

Meanwhile you can do something like this:

#if __has_include(<uchar.h>)
#include <uchar.h>
#else
typedef uint16_t uchar16_t;
typedef uint32_t uchar32_t;
#endif
GMeur
GMeurAuthor
Associate III
February 17, 2025

Yeah, it's what I did for now, but as stated in my first msg, I'd rather use default headers.

As to get Unicode support from touchgfx, I kind of agree. Problem is, I mixed up char16_t and touchgfx::Unicode::UnicodeChar and it's just an old code I'm migrating from iar to cubeIDE and I'd rather not touch it besides the obvious modifications to make it compile on gcc.

STTwo-32
Technical Moderator
February 15, 2025

Hello @GMeur 

Thank you so much for escalating this. I've sent your feedback to our team to review his implementation on the STM32CubeIDE (under internal ticket number 203895).

Best Regards.

STTwo-32

Pavel A.
Super User
February 15, 2025

Newlib deliberately omitted Unicode support because of large data tables needed for conversion (and need to update these tables every time when somebody invents new weird characters :pile_of_poo:). But they can provide just the uchar.h and mbstate_t.h, without implementation of mbrtoc32, c32rtomb and so on.

MCU users that really want Unicode should get it from the GUI software such as TouchGFX.