NOTICE: This website will be shut down in the near future. Product content has moved to nxp.com. Forum content and FAQs have been moved to community.nxp.com. We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions and look forward to seeing you at our new web location.

 

wchar_t warning when linking with library generated by another toolchain

lpcxpresso-support's picture

There is a standard know 'issue' with interworking code compiled with different toolchains, which is a result of the ARM AEABI documentation allowing the size of wchar_t to be compiler defined. GCC uses a wchar_t size of 4, but some other toolchains use a size of 2.

This can result in linker warning similar to the one below being generated when building an application with LPCXpresso which links in a library archive or object file generated using another toolchain:

c:/nxp/lpcxpresso_7.2.0_153/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: warning: C:\workspace\myproj\src\libextcode.a(code.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

Unless your codebase actually uses wchar types (generally unlikely for most embedded application), then you can solve this problem by simply adding the linker flag "-no-wchar-size-warning" to your LPXpresso project by navigating to

Project - Properties - C/C++ Build - Settings - Tool Settings - MCU Linker - Miscellaneous

and adding "-no-wchar-size-warning" to the "Other options" box. Remember to do this for all Build Configurations (Debug and Release).


See also:

0
Your rating: None
feedback