diff --git a/src/ArduinoJson.hpp b/src/ArduinoJson.hpp index d16ca08c..ca76c1e1 100644 --- a/src/ArduinoJson.hpp +++ b/src/ArduinoJson.hpp @@ -6,6 +6,13 @@ #include "ArduinoJson/Configuration.hpp" +// Include Arduino.h before stdlib.h to avoid conflict with atexit() +// https://github.com/bblanchon/ArduinoJson/pull/1693#issuecomment-1001060240 +#if ARDUINOJSON_ENABLE_ARDUINO_STRING || ARDUINOJSON_ENABLE_ARDUINO_STREAM || \ + ARDUINOJSON_ENABLE_ARDUINO_PRINT || ARDUINOJSON_ENABLE_PROGMEM +# include +#endif + #if !ARDUINOJSON_DEBUG # ifdef __clang__ # pragma clang system_header