gmag11 / ESPNtpClient

High accuracy NTP library for ESP32 and ESP8266
MIT License
118 stars 25 forks source link

Ambiguous reference to byte due to using namespace std #22

Closed LeisureLadi closed 2 years ago

LeisureLadi commented 3 years ago

Hi gmag11,

First of all I'd like to say, that I very much appreciate the library you have developed, so I'm keen using it in my sketch.

However, I encountered an issue with 'using namespace std;' in ESPNtpClient.h. It causes an ambiguity in main application and other libraries, when variables are as 'byte'.

For verification I used the 'advancedExample' included with your library and just added a global variable 'byte test=0'. Without this declaration, the example compiles fine. If included, the mentioned message is thrown.

The general issue is also described on 'stackoverflow' (https://stackoverflow.com/questions/45125957/byte-and-ambiguous-symbol-due-to-using-declarations).

For the sake of completeness, I'm using ESP 3.0.2 SDK, Wemos D1 mini and Arduino IDE 1.8.15.

Do you think this ambiguity could be avoided?

gmag11 commented 2 years ago

I've removed namespaces references in 588d28f63129497e51567d6aafc3e476c7639437. It seems to work with latest Arduino cores both for ESP32 and ESP8266