bblanchon / ArduinoJson

📟 JSON library for Arduino and embedded C++. Simple and efficient.
https://arduinojson.org
MIT License
6.76k stars 1.12k forks source link

ArduinoStringAdapter.hpp:7:10: fatal error: WString.h: No such file or directory #1381

Closed youcangetme closed 4 years ago

youcangetme commented 4 years ago

I am compiling for the new Teknic ClearCore using the Arduino wrappers and the Arduino IDE. It is pretty spot of Arduino compatible with a few exceptions. The architecture is described as "32-bit ARM Cortex M4F processor operating at 120MHz with 512kB FLASH and 192kB RAM. DSP and floating point instruction sets."

Here is the error I get

` In file included from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/StringAdapters.hpp:16:0, from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Misc/SerializedValue.hpp:7, from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantData.hpp:8, from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/SlotFunctions.hpp:8, from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:7, from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8, from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:17, from C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9, from C:\Users\youca\AppData\Local\Temp\arduino_modified_sketch_599557\JsonConfigFile.ino:22: C:\Users\youca\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/ArduinoStringAdapter.hpp:7:10: fatal error: WString.h: No such file or directory

include

      ^~~~~~~~~~~

compilation terminated. exit status 1 Error compiling for board Teknic ClearCore.`

I tried the usual workaround and included said libs directly in the same folder with no luck. This is just including the ArduinoJson.h so if I take it out all of these errors disappear.

I am sure this is pilot error and if somebody could give me direction as to what I am doing wrong it would be great. Thanks!

bblanchon commented 4 years ago

Hi @youcangetme,

Thank you very much for reporting this issue.

Every Arduino-compatible core has a WString.h that contains the definition of the String class. Unfortunately, Teknic ClearCore renamed this file to ArduinoString.h.

To me, this is a mistake from Teknic and they must align their file names to the official ones; otherwise, they cannot claim to be Arduino-compatible. @youcangetme, can you contact Teknic support to report this issue?

Best regards, Benoit

bblanchon commented 4 years ago

I spoke too quickly.

I just discovered that Arduino team has deprecated the WString.h header:

// including WString.h is deprecated, for all future projects use Arduino.h instead

I'll modify ArduinoJson to include Arduino.h instead.

bblanchon commented 4 years ago

The fix is available in the 6.x branch and will be available in the next release.

However, there is still an error when compiling for Teknic ClearCore:

arduino/api/deprecated-avr-comp/avr/pgmspace.h:107:49: error: 'const void*' is not a pointer-to-object type
 #define pgm_read_ptr(addr) (*(const void *)(addr))
                                                 ^

This is due to a bug in the hardware-independent core.

Until this bug is fixed, you can either:

Thanks again for reporting this issue 👍

youcangetme commented 4 years ago

Thanks @bblanchon ! This is progress so I am happy. I tried the other JSON libs and your's is the best license and the best code wise. Thank you for your time and help! I will try some of the work around and see if I can get past this.

youcangetme commented 4 years ago

@bblanchon I used the follow and got it to compile. Thank you for helping!

`#define ARDUINOJSON_ENABLE_PROGMEM 0

include `