#include <ThingerESP8266.h> Compilation error

I include a better exposition of the compilation failure with the idea of geting help from the community.
I extract the 7 compilation errors.

Environment: Arduino:1.8.13 (Windows 10) - NodeMCU 1.0 (ESP-12E Module) - Thinger.io: 2.16.0 - ESP8266WiFi: 1.0

Error 1:

…\Arduino\libraries\thinger.io\src/ThingerClient.h:

110: virtual bool read(char* buffer, size_t size)

In member function ‘virtual bool ThingerClient::read(char*, size_t)’

112: unsigned long start = millis();

128: if(read<=0 && abs(millis()-start)>=DEFAULT_READ_TIMEOUT){

45: error: call of overloaded ‘abs(long unsigned int)’ is ambiguous

Error 2:

…\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\stdlib.h:

74 :5: note: candidate: ‘int abs(int)’

Error 3:

…\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\c++\10.2.0\cstdlib: 77

…\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\c++\10.2.0\stdlib.h: 36

…\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266/Arduino.h: 27

…\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\c++\10.2.0\bits\std_abs.h:

79 | abs(long double __x) |

79: 3: note: candidate: ‘constexpr long double std::abs(long double)’

Error 4:

…\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\c++\10.2.0\bits\std_abs.h:

75 | abs(float __x) |

75: 3: note: candidate: ‘constexpr float std::abs(float)’

Error 5:

…\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\c++\10.2.0\bits\std_abs.h:

71 | abs(double __x) |

71 :3: note: candidate: ‘constexpr double std::abs(double)’

Error 6:

…\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\c++\10.2.0\bits\std_abs.h:

61 | abs(long long __x) { return __builtin_llabs (__x); } |

61 :3: note: candidate: ‘long long int std::abs(long long int)’

Error 7:

… \appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\xtensa-lx106-elf\include\c++\10.2.0\bits\std_abs.h:

56 | abs(long __i) { return __builtin_labs(__i); } |

Hi,

did you installed the ESP8266 board on Arduino and selected it? Tested it on arduino with latest library version:

I also encountered the same problem.
Can you help me…

MAC OS 11.5 and WINDOWS 10 (21H1)
Arduion 1.8.15 + Thinger.io 2.15(2.16)
NodeMCU V3

Hi, check this, I would recommend to check the ESP8266 board controller version, last version has given some compiling errors to me, downgrade it to a previous version will make it work

Thank you very much, my esp8266 controller board version 2.7.4 can work.
MAC Arduino 1.8.15 esp8266 controller board version 2.7.4 thinger 2.16

Anyhow it is always better to pass clearly defined variables to thinger.
Passing directly the result of an abs() to an overloaded function is probably not a good idea.
You may want to use a few clearly defined intermediary variables so that the type is not ambiguous.

Hi! we have updated today the library version to 2.17.0 with support for newer ESP8266 core! So, compiling errors should be gone. I recommend the update for everyone using ESP8266 or ESP32, as by default, the client now verifies SSL/TLS connections, both for community and private instances.