cancel
Showing results for 
Search instead for 
Did you mean: 

UChar.h is missing

GMeur
Senior II

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.

 

4 REPLIES 4
Pavel A.
Evangelist III

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
STTwo-32
ST Employee

Hello @GMeur 

Thank you so much for escalating this. I will send your feedback to our team to review his implementation on the STM32CubeIDE.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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.

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.