diff --git a/CHANGELOG.md b/CHANGELOG.md index 28c506ab..04604e1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ ArduinoJson: change log ======================= +HEAD +---- + +* Fix error `'std::string' has not been declared` (issue #1967) + v6.21.3 (2023-07-23) ------- diff --git a/extras/tests/Misc/CMakeLists.txt b/extras/tests/Misc/CMakeLists.txt index 5655a089..3a1eb898 100644 --- a/extras/tests/Misc/CMakeLists.txt +++ b/extras/tests/Misc/CMakeLists.txt @@ -6,6 +6,7 @@ add_executable(MiscTests arithmeticCompare.cpp conflicts.cpp FloatParts.cpp + issue1967.cpp JsonString.cpp NoArduinoHeader.cpp printable.cpp diff --git a/extras/tests/Misc/issue1967.cpp b/extras/tests/Misc/issue1967.cpp new file mode 100644 index 00000000..a8d6b948 --- /dev/null +++ b/extras/tests/Misc/issue1967.cpp @@ -0,0 +1,13 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2023, Benoit BLANCHON +// MIT License + +// we expect ArduinoJson.h to include +#define ARDUINOJSON_ENABLE_STD_STRING 1 + +// but we don't want it to included accidentally +#undef ARDUINO +#define ARDUINOJSON_ENABLE_STD_STREAM 0 +#define ARDUINOJSON_ENABLE_STRING_VIEW 0 + +#include diff --git a/src/ArduinoJson/Variant/ConverterImpl.hpp b/src/ArduinoJson/Variant/ConverterImpl.hpp index e95b33e5..5318242b 100644 --- a/src/ArduinoJson/Variant/ConverterImpl.hpp +++ b/src/ArduinoJson/Variant/ConverterImpl.hpp @@ -8,6 +8,10 @@ #include #include +#if ARDUINOJSON_ENABLE_STD_STRING +# include +#endif + ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE template