Skip to main content
Senior III
May 20, 2026
Question

STM32Cube_FW_G0_V1.6.3 precompiled math.lib Inconsistent wchar_t size with IAR 9.20 and up

  • May 20, 2026
  • 3 replies
  • 66 views

I'm using the latest library provided by the STM32Cube_FW_G0_V1.6.3, specifically STM32Cube_FW_G0_V1.6.3\Drivers\CMSIS\DSP\Lib\ARM\arm_cortexM0l_math.lib

but when using IAR 9.20 I'm having the warning

	Warning[Lt009]: Inconsistent wchar_t size			
	 arm_sin_f32.o(arm_cortexM0l_math.lib) and 1 other objects in arm_cortexM0l_math.lib have wchar_t size 16 bits			
	 my_file.o and 54 other objects, some of them in rt6M_tl.a and 5 other libraries have wchar_t size 32 bits			

How do I avoid the mismatch?

I would like to avoid to link the source code for the cortex M math library and compile it myself.

3 replies

Pavel A.
Super User
May 20, 2026

In your main project, how is wchar_t defined? Do you use any text functions (trace, logs...) with wide chars?

See also: 

https://mypages.iar.com/iarlogin/s/article/Library-built-with-7-xx-causes-warning-message-in-8-xx-or-later?language=en_US

 

nico23Author
Senior III
May 21, 2026

I'm using stdlib.h and stddef.h, which define

#ifndef _WCHART
 #define _WCHART
 typedef _Wchart wchar_t;
#endif

But I'm not directly defining it nor using trace, logs, or any text function.

Pavel A.
Super User
May 22, 2026

Well then just ignore this warning, build and test your program. If it crashes or behaves weird, see the above link.

 

Explorer
May 22, 2026

This usually happens due to a mismatch between the STM32Cube firmware package and the toolchain/precompiled libraries.

Try doing a clean rebuild and make sure your CubeFW version and compiler settings match exactly — in many cases that fixes the wchar_t / math lib inconsistency issue.