SparkJson is not compiling

So I’m trying to used SparkJson but I get this compile error

warning: deleting object of polymorphic class type 'ArduinoJson::DynamicJsonBuffer' which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] ~DynamicJsonBuffer() { delete _next; }

Does anyone have idea how to fix this error? I’m not using the DynamicJsonBuffer, I’m guessing it’s something new with the compiler, because noting has changed in this lib since 2015. I’m using Particle workbench btw.

I’m getting this too - Did you make any progress?

How are you using the functions?
IIRC, DynamicJsonBuffer is not meant to be used as global but wants to be used inside a function.

BTW, warnings won’t stop you from building your code and a “suspected” issue may not be one after all.

However, I’d suggest using JsonParserGeneratorRK instead anyway - that library will be properly maintained by @rickkas7 while SparkJson is quite dated (as the name suggests).

Alternatively you can use ArduinoJson which is also well maintained.

2 Likes

Hi ScruffR.

I had not used DynamicJsonBuffer in anyway yet, I only had the include statement and the loop and setup methods.

The issue was resolved by updating my firmware from 0.6.4 to 1.2.0 - As you mentioned on another issue.

Thanks again for your help.

1 Like