Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile errors with ArduinoJson #109

Open
plop510 opened this issue Nov 8, 2020 · 5 comments
Open

Compile errors with ArduinoJson #109

plop510 opened this issue Nov 8, 2020 · 5 comments

Comments

@plop510
Copy link

plop510 commented Nov 8, 2020

I recently discover this repository and tested it with diferent arduino or ESP programs and I´m really impressed and thankfull for this excelent job that open paths to many posibilities.

The thing I´m testing now is I2C master (RPI) / slave (Arduino) using JSON over the I2C interface by means of ArduinoJson library. Any example (as master) that compiles for Arduino or ESP32, doesn´t compile for RPI: just on the first includes:
#include <ArduinoJson.hpp>, #include <ArduinoJson.h>

I get a bunch of errors like that:
C:\Users\plop5\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/FlashStringIterator.hpp:14:12: error: 'ArduinoJson6170_91::FlashStringIterator::FlashStringIterator(const char*)' cannot be overloaded with 'ArduinoJson6170_91::FlashStringIterator::FlashStringIterator(const __FlashStringHelper*)'
explicit FlashStringIterator(const char* ptr) : _ptr(ptr) {}
^~~~~~~~~~~~~~~~~~~
C:\Users\plop5\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/FlashStringIterator.hpp:11:12: note: previous declaration 'ArduinoJson6170_91::FlashStringIterator::FlashStringIterator(const __FlashStringHelper*)'
explicit FlashStringIterator(const __FlashStringHelper* ptr)
^~~~~~~~~~~~~~~~~~~
....
C:\Users\plop5\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/FlashStringAdapter.hpp:56:27: error: ambiguating new declaration of 'ArduinoJson6170_91::FlashStringAdapter ArduinoJson6170_91::adaptString(const __FlashStringHelper*)'
inline FlashStringAdapter adaptString(const __FlashStringHelper* str) {
^~~~~~~~~~~
.....
C:\Users\plop5\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp: In instantiation of 'typename ArduinoJson6170_91::enable_if<ArduinoJson6170_91::is_pointer::value, T>::type ArduinoJson6170_91::pgm_read(const void*) [with T = const char*; typename ArduinoJson6170_91::enable_if<ArduinoJson6170_91::is_pointer::value, T>::type = const char*]':
C:\Users\plop5\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Deserialization/DeserializationError.hpp:103:12: required from here
C:\Users\plop5\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp:14:42: error: 'pgm_read_ptr' was not declared in this scope
return reinterpret_cast(pgm_read_ptr(p));
~~~~~~~~~~~~^~~
C:\Users\plop5\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp:14:42: note: suggested alternative: 'pgm_read_word'
return reinterpret_cast(pgm_read_ptr(p));
~~~~~~~~~~~~^~~
pgm_read_word
exit status 1
Error compilando para la tarjeta RaspberryPI B+/2.

Etc. Please, can you help me to go ahead? maybe some compile option setting...

Thanks in advance,

@pfink
Copy link

pfink commented Jan 16, 2021

This could probably be fixed by setting these options:

-D ARDUINOJSON_ENABLE_ARDUINO_STRING
-D ARDUINOJSON_ENABLE_PROGMEM=0

@plop510
Copy link
Author

plop510 commented Jan 20, 2021

Thanks pfink, I´ll test it.

@plop510
Copy link
Author

plop510 commented Jan 20, 2021

Hello pfink,

I put a file: platform.local.txt on ..\arduino-1.8.9\hardware\RaspberryPi\piduino\platform.local.txt
with just this line:
"compiler.cpp.extra_flags=-DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_ENABLE_PROGMEM=0"

Now, when compiling, I don´t get the previous errors but the result is different: I get 20 error lines with this content:
"C:/SysGCC/Raspberry/bin/arm-linux-gnueabihf-ar: u' modifier ignored since D' is the default (see `U')"

and no code is generated.

Please help.

@pfink
Copy link

pfink commented Jan 20, 2021

Sorry don't know how to solve it I'm building with platformio.

@plop510
Copy link
Author

plop510 commented Jan 21, 2021

Hello pfink,

Please, forget my last message. Your solution worked. At least RPI code is generated OK.
I will test It.

Thanks a lot.

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants