You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just to flag there is actually a much easier fix that does not require compiler flags and should work everywhere.
Before including ArduinoJson.h, do this:
#include <Arduino.h>
#undef min
min is guaranteed to be defined in C++ so we don't have to worry that we will remove the only definition (it's also supposed to be an inline function and not a macro, which is why it conflicts in the first place)
Including the header ourselves guarantees that all the macros are defined and that the header won't be reincluded by someone else. #undef min then removes the conflicting macro definition.
This will work:
On all systems where someone uses ArduinoJSON
whether the min macro exists or not.
without removing support for std::*
Figured i would flag this.
The text was updated successfully, but these errors were encountered:
At least as you have things now, you would not have to #undef max, because
ArduinoJson doesn't use max.
If that changed, yes, you would run smack into the same problem unless you
#undef max.
(It's not obvious where the website docs live in github, or i'd just submit a pull request)
The troubleshooter for the std::min vs arduino min macro (https://arduinojson.org/v6/troubleshooter/?utm_source=github&utm_medium=readme#compiletime/macro-min/success) says to disable std::string/std::stream support.
Just to flag there is actually a much easier fix that does not require compiler flags and should work everywhere.
Before including ArduinoJson.h, do this:
min is guaranteed to be defined in C++ so we don't have to worry that we will remove the only definition (it's also supposed to be an inline function and not a macro, which is why it conflicts in the first place)
Including the header ourselves guarantees that all the macros are defined and that the header won't be reincluded by someone else.
#undef min
then removes the conflicting macro definition.This will work:
Figured i would flag this.
The text was updated successfully, but these errors were encountered: