I have code that uses the SparkJson library. I have successfully compiled and loaded this code from the Web IDS onto my Argon device.
I am moving to VSCode, so I created a new project and used the VSCode/Particle tools to install the libraries locally.
When I CLOUD compile (tried with 2.0.0-rc2 and with 1.5.2), I get this warning/problem.
Problem:
Dynamic.JsonBuffer.h lib/SparkJson/src
deleting object of polymorphic class type 'ArduinoJson::DynamicJsonBuffer' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
Output Error:
lib/SparkJson/src/././DynamicJsonBuffer.h: In destructor 'ArduinoJson::DynamicJsonBuffer::~DynamicJsonBuffer()':
lib/SparkJson/src/././DynamicJsonBuffer.h:20:33: warning: deleting object of polymorphic class type 'ArduinoJson::DynamicJsonBuffer' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
20 | ~DynamicJsonBuffer() { delete _next; }
| ^~~~~
Building cpp file: lib/SparkJson/src/JsonVariant.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-12-mSparkJson/src/
arm-none-eabi-gcc -DSTM32_DEVICE -DnRF52840 -DNRF52840_XXAA -DPLATFORM_THREADING=1 -DPLATFORM_ID=12 -DPLATFORM_NAME=argon -DPLATFORM_GEN=3 -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00C -DUSBD_PID_CDC=0xC00C -DSP
at makeError (/Users/XXX/.vscode/extensions/particle.particle-vscode-core-1.12.3/node_modules/execa/lib/error.js:58:11)
at handlePromise (/Users/XXX/.vscode/extensions/particle.particle-vscode-core-1.12.3/node_modules/execa/index.js:114:26)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
- - - -
I am not sure how to deal with this. Stackoverflow has a couple threads with this error, but they basically say “Don’t use this class”.
As this works on the cloud, but not with the cloud compile command on VSCode.
Also… I just tried to do a local compile and it appears to have completed successfully. But I have not tested that code on a device yet.