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
My code arduino for GatewayESP8266MQTTClient get error when compiling for 3.x.x ESP8266 Board. In my code, i used ESP8266WebServer lib for WifiManager Lib.
This is my error: In file included from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/StreamDev.h:25, from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer-impl.h:31, from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:340, from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:62: C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/StreamString.h:54:50: error: macro "max" requires 2 arguments, but only 1 given 54 | return std::numeric_limits<int16_t>::max(); | ^ In file included from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:60: C:\Users\ADMIN\Documents\Arduino\libraries\MySensors/MySensors.h:98: note: macro "max" defined here 98 | #define max(a,b) ((a)>(b)?(a):(b)) //!< max | In file included from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer-impl.h:31, from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:340, from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:62: C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/StreamDev.h:51:50: error: macro "max" requires 2 arguments, but only 1 given 51 | return std::numeric_limits<int16_t>::max(); | ^ In file included from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:60: C:\Users\ADMIN\Documents\Arduino\libraries\MySensors/MySensors.h:98: note: macro "max" defined here 98 | #define max(a,b) ((a)>(b)?(a):(b)) //!< max | In file included from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer-impl.h:31, from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:340, from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:62: C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/StreamDev.h:118:50: error: macro "max" requires 2 arguments, but only 1 given 118 | return std::numeric_limits<int16_t>::max(); | ^ In file included from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:60: C:\Users\ADMIN\Documents\Arduino\libraries\MySensors/MySensors.h:98: note: macro "max" defined here 98 | #define max(a,b) ((a)>(b)?(a):(b)) //!< max | In file included from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer-impl.h:31, from C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:340, from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:62: C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/StreamDev.h:145:50: error: macro "max" requires 2 arguments, but only 1 given 145 | return std::numeric_limits<int16_t>::max(); | ^ In file included from C:\Users\ADMIN\Desktop\20210921_gateway_new_topic\20210921_gateway_new_topic.ino:60: C:\Users\ADMIN\Documents\Arduino\libraries\MySensors/MySensors.h:98: note: macro "max" defined here 98 | #define max(a,b) ((a)>(b)?(a):(b)) //!< max |
Can Anyone help me?
The text was updated successfully, but these errors were encountered:
dungdao191299
changed the title
Error compiling for 3.x.x ESP8266 board when use both Wifi Manager and MySensor.
Error compiling for 3.x.x ESP8266 board when use both WifiManager lib and MySensor lib.
Sep 21, 2021
I found a way to hack it. I move #include <MySensors.h> to the end of them. Like as:
My code was compiled and working. But do anyone know the reason? Sorry for my ignorance, i am a newbie
This max-macro brakes in multiple ESP8266 libraries code lines where max() is used in an different context, e.g. as a method of a class, or in your case the full qualified library function std::numeric_limits<int16_t>::max(), see: esp lib code
Basically this is a bad design decision and should be changed in MySensors library.
The ESP library uses a macro for max which is called max with a leading underscore: _max()
This macro should be used in the MySensors code to stay compatible with the multiple ESP8266 libraries.
It would be perfect helpful if you could create an additional issue for this.
Thank you
My code arduino for GatewayESP8266MQTTClient get error when compiling for 3.x.x ESP8266 Board. In my code, i used ESP8266WebServer lib for WifiManager Lib.
![image](https://user-images.githubusercontent.com/54898195/134142354-e54ca7aa-e68f-4eda-b662-3000dfe9e681.png)
The text was updated successfully, but these errors were encountered: