Post topics, source code that relate to the Arduino Platform

User avatar
By esp360t
#81799 The attached sketch works with esp8266 board Version 2.4.2

It will NOT compile using board Version 2.5.0

The compiler error points to line 45 in sendemail.cpp library file.

ambiguous overload for 'operator+=' (operand types are 'String' and 'IPAddress')
buffer += client->localIP();

Can someone suggest an edit to sendemail.cpp so that it will work with board Version 2.5.0 ?

Unfortunately the author of the sendemail library, Peter Gorasz, does not include his email on GitHub.

Here is the error text:

Arduino: 1.8.8 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Enabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Utilities\arduino-1.8.8\portable\sketchbook\libraries\esp8266-sendemail-master\sendemail.cpp: In member function 'bool SendEmail::send(const String&, const String&, const String&, const String&)':

C:\Utilities\arduino-1.8.8\portable\sketchbook\libraries\esp8266-sendemail-master\sendemail.cpp:45:10: error: ambiguous overload for 'operator+=' (operand types are 'String' and 'IPAddress')

buffer += client->localIP();

^

C:\Utilities\arduino-1.8.8\portable\sketchbook\libraries\esp8266-sendemail-master\sendemail.cpp:45:10: note: candidates are:

In file included from C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/Arduino.h:261:0,

from C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WiFi\src/WiFiClient.h:25,

from C:\Utilities\arduino-1.8.8\portable\sketchbook\libraries\esp8266-sendemail-master\sendemail.h:6,

from C:\Utilities\arduino-1.8.8\portable\sketchbook\libraries\esp8266-sendemail-master\sendemail.cpp:1:

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:120:18: note: String& String::operator+=(const char*) <near match>

String & operator +=(const char *cstr) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:120:18: note: no known conversion for argument 1 from 'IPAddress' to 'const char*'

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:124:18: note: String& String::operator+=(char)

String & operator +=(char c) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:128:18: note: String& String::operator+=(unsigned char)

String & operator +=(unsigned char num) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:132:18: note: String& String::operator+=(int)

String & operator +=(int num) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:136:18: note: String& String::operator+=(unsigned int)

String & operator +=(unsigned int num) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:140:18: note: String& String::operator+=(long int)

String & operator +=(long num) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:144:18: note: String& String::operator+=(long unsigned int)

String & operator +=(unsigned long num) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:148:18: note: String& String::operator+=(float)

String & operator +=(float num) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:152:18: note: String& String::operator+=(double)

String & operator +=(double num) {

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:156:18: note: String& String::operator+=(const __FlashStringHelper*) <near match>

String & operator += (const __FlashStringHelper *str){

^

C:\Utilities\arduino-1.8.8\portable\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:156:18: note: no known conversion for argument 1 from 'IPAddress' to 'const __FlashStringHelper*'

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
You do not have the required permissions to view the files attached to this post.