inttypes.h fails to define PRIi64 and friends with newlib

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

inttypes.h fails to define PRIi64 and friends with newlib

336 Views
stefanct
Contributor III

Basically what Jonathan wrote in his Debian bug report also applies to MCUXpresso (11.9.0, I havent tried .1 yet): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1067692

This can be reproduced in the hello world example for any i.mx rt device (I have only tested RT1021):

  1. switch to any newlib or newlib-nano configuration in the linker section of the project configuration,
  2. add #include <inttypes.h>
  3. change the output statement to PRINTF("Hello World %" PRId64 "\r\n", 42ULL);

Building will then fail with:

error: expected ')' before 'PRId64'

Adding the workaround of adding #include <sys/_stdint.h> before inttypes.h makes it build as explained in the bug report.described

Tags (1)
3 Replies

240 Views
kstribrnAmzn
Contributor I

I found the same issue to exist in both the 11.9.1 and 11.8.1 releases. As suggested in the bug report adding `#include <sys/_stdint.h>` before `#include <inttypes.h>` does seem to do the trick but this is obviously not a good long term work around.

I was testing with the pub-sub demo from https://github.com/FreeRTOS/iot-reference-nxp-rt1060.

0 Kudos
Reply

294 Views
AdrianOltean
NXP Employee
NXP Employee

Note that Newlib/NewlibNano libraries are not under the control of the IDE. The MCUXpresso IDE bundles an unmodified form of the GNU ARM Embedded Toolchain comprising the GNU compiler and supporting runtime including newlib / newlib-nano.

Regards,

Adrian

0 Kudos
Reply

309 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @stefanct,

Thanks for reporting this issue. I will relay it to the IDE team for their consideration.

BR,
Edwin.

0 Kudos
Reply