8000 Fix 'std::string' has not been declared (issue #1967) · smartcoder00/ArduinoJson@259855a · GitHub
[go: up one dir, main page]

Skip to content

Commit 259855a

Browse files
committed
Fix 'std::string' has not been declared (issue bblanchon#1967)
1 parent aebf042 commit 259855a

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
ArduinoJson: change log
22
=======================
33

4+
HEAD
5+
----
6+
7+
* Fix error `'std::string' has not been declared` (issue #1967)
8+
49
v6.21.3 (2023-07-23)
510
-------
611

extras/tests/Misc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_executable(MiscTests
66
arithmeticCompare.cpp
77
conflicts.cpp
88
FloatParts.cpp
9+
issue1967.cpp
910
JsonString.cpp
1011
NoArduinoHeader.cpp
1112
printable.cpp

extras/tests/Misc/issue1967.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// ArduinoJson - https://arduinojson.org
2+
// Copyright © 2014-2023, Benoit BLANCHON
3+
// MIT License
4+
5+
// we expect ArduinoJson.h to include <string>
6+
#define ARDUINOJSON_ENABLE_STD_STRING 1
7+
8+
// but we don't want it to included accidentally
9+
#undef ARDUINO
10+
#define ARDUINOJSON_ENABLE_STD_STREAM 0
11+
#define ARDUINOJSON_ENABLE_STRING_VIEW 0
12+
13+
#include <ArduinoJson.h>

src/ArduinoJson/Variant/ConverterImpl.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include <ArduinoJson/Variant/JsonVariantConst.hpp>
99
#include <ArduinoJson/Variant/VariantFunctions.hpp>
1010

11+
#if ARDUINOJSON_ENABLE_STD_STRING
12+
# include <string>
13+
#endif
14+
1115
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
1216

1317
template <typename T, typename Enable>

0 commit comments

Comments
 (0)
0