Skip to content

Compile error when using fixed size integer macros from inttypes.h #8220

Closed
@ardui-no

Description

@ardui-no

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [other]
  • Core Version: [2021-07-16]
  • Development Env: [Arduino IDE]
  • Operating System: [Ubuntu]

Settings in IDE

  • Module: [Generic ESP8266 Module]
  • Flash Mode: [dout]
  • Flash Size: [1MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

Compile error when using the fixed size integer macros from inttypes.h with library versions 3.0.0+ but was OK in previous versions (e.g. v2.7.4). The code example also compiles OK on GNU GCC v7.1.1

MCVE Sketch

#include <Arduino.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>

void setup() {
  char buffer[100] = {0};
  uint32_t v = 12345;
  
  sprintf(buffer,"%" PRIu32, v);
}

void loop() {
}

Debug Messages

Error message is:

MCVE.ino: In function 'void setup()':
MCVE:10:21: error: expected ')' before '__INT32'
   10 |   sprintf(buffer,"%" PRIu32, v);
      |          ~          ^
      |                     )
exit status 1
expected ')' before '__INT32'

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions