GerLech / WebConfig

For ESP8266 and ESP32 edit configuration with web page and save it on SPIFFS. If no connection to a local WLAN exists configuration over web page can be done using an access point
GNU Lesser General Public License v3.0
80 stars 19 forks source link

Example sketches do not compile against current version of ArduinoJson #15

Open Jefficus opened 3 years ago

Jefficus commented 3 years ago

Compiling the demo8266.ino sketch fails due to conflicts as shown below. I was trying to compile against the latest ArduinoJson (16.18.4) but found that by reverting all the way back to 16.16.1, the compilation succeeded. Using the older version of the JSON library will probably be sufficient for my needs, but thought I should report this for the benefit of those who might need the newer version. Also, it might be worth documenting in the README which version of the ArduinoJson library has been verified.

/home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp: In member function 'void WebConfig::addDescription(String)': /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:129:3: error: 'DeserializationError' was not declared in this scope DeserializationError error; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:129:24: error: expected ';' before 'error' DeserializationError error; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:132:3: error: 'DynamicJsonDocument' was not declared in this scope DynamicJsonDocument doc(capacity); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:132:23: error: expected ';' before 'doc' DynamicJsonDocument doc(capacity); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:134:3: error: 'error' was not declared in this scope error = deserializeJson(doc,parameter); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:134:27: error: 'doc' was not declared in this scope error = deserializeJson(doc,parameter); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:134:40: error: 'deserializeJson' was not declared in this scope error = deserializeJson(doc,parameter); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:140:39: error: expected primary-expression before '>' token JsonArray array = doc.as(); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:140:41: error: expected primary-expression before ')' token JsonArray array = doc.as(); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:142:27: error: use of deleted function 'ArduinoJson::JsonObject::JsonObject(const ArduinoJson::JsonObject&)' for (JsonObject obj : array) { ^ In file included from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.hpp:12:0, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.h:10, from /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:27: /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/JsonObject.hpp:39:7: note: 'ArduinoJson::JsonObject::JsonObject(const ArduinoJson::JsonObject&)' is implicitly deleted because the default definition would be ill-formed: class JsonObject : public Internals::JsonPrintable, ^ In file included from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/JsonArray.hpp:12:0, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.hpp:11, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.h:10, from /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:27: /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/Data/ReferenceType.hpp:31:3: error: 'ArduinoJson::Internals::ReferenceType::ReferenceType(const ArduinoJson::Internals::ReferenceType&)' is private ReferenceType(const ReferenceType&); ^ In file included from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.hpp:12:0, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.h:10, from /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:27: /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/JsonObject.hpp:39:7: error: within this context class JsonObject : public Internals::JsonPrintable, ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:169:56: error: use of deleted function 'ArduinoJson::JsonArray::JsonArray(const ArduinoJson::JsonArray&)' JsonArray opt = obj["options"].as(); ^ In file included from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.hpp:11:0, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.h:10, from /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:27: /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/JsonArray.hpp:40:7: note: 'ArduinoJson::JsonArray::JsonArray(const ArduinoJson::JsonArray&)' is implicitly deleted because the default definition would be ill-formed: class JsonArray : public Internals::JsonPrintable, ^ In file included from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/JsonArray.hpp:12:0, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.hpp:11, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.h:10, from /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:27: /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/Data/ReferenceType.hpp:31:3: error: 'ArduinoJson::Internals::ReferenceType::ReferenceType(const ArduinoJson::Internals::ReferenceType&)' is private ReferenceType(const ReferenceType&); ^ In file included from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.hpp:11:0, from /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson.h:10, from /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:27: /home/jeffs/Arduino/libraries/ArduinoJson/ArduinoJson/JsonArray.hpp:40:7: error: within this context class JsonArray : public Internals::JsonPrintable, ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:171:31: error: use of deleted function 'ArduinoJson::JsonObject::JsonObject(const ArduinoJson::JsonObject&)' for (JsonObject o : opt) { ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp: In member function 'String WebConfig::getResults()': /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:493:3: error: 'StaticJsonDocument' was not declared in this scope StaticJsonDocument<1000> doc; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:493:28: error: 'doc' was not declared in this scope StaticJsonDocument<1000> doc; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:510:27: error: 'serializeJson' was not declared in this scope serializeJson(doc,buffer); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp: In member function 'void WebConfig::setValues(String)': /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:519:3: error: 'DeserializationError' was not declared in this scope DeserializationError error; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:519:24: error: expected ';' before 'error' DeserializationError error; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:520:3: error: 'StaticJsonDocument' was not declared in this scope StaticJsonDocument<1000> doc; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:520:28: error: 'doc' was not declared in this scope StaticJsonDocument<1000> doc; ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:521:3: error: 'error' was not declared in this scope error = deserializeJson(doc, json); ^ /home/jeffs/Arduino/libraries/WebConfig/src/WebConfig.cpp:521:36: error: 'deserializeJson' was not declared in this scope error = deserializeJson(doc, json); ^ exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module).

KoffeinKaio commented 3 years ago

6.18.5 compiles just fine for me ( you might have an error in your version strings, there is no (16.*)

martibc16 commented 2 years ago

I got the same error, I fixed by using the version @KoffeinKaio mentions. I don't now why but by default it picks version 5.13.4 which gives compilation errors.

Adding:

lib_deps = 
    https://github.com/bblanchon/ArduinoJson.git#6ea2815341582759ac566fc836ab575f6414563d

Solved the problem for me.