Compile Error: call of overloaded 'append(long unsigned int&)' is ambiguous [SOLVED]

Hello,

I am having an issue adding a couple new webpage entries to my
sketch due to a " call of overloaded 'append(long unsigned int&)' is ambiguous" compile error. I am unsure if this is a quirk with the ESP32 being used because I can use the Stackstring function with these various integer types on a UNO Wifi Rev2 with no compile error. I have tried assigning different integer types but so far nothing is accepted compiling the ESP32 code.

Compiler error message:

WARNING: library StackString claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
C:\Users\Ed\IDE 2.0 Sketches-Libraries\Pump_House_Monitor_ver8J\Pump_House_Monitor_ver8J.ino: In function 'void loop()':
C:\Users\Ed\IDE 2.0 Sketches-Libraries\Pump_House_Monitor_ver8J\Pump_House_Monitor_ver8J.ino:335:48: error: call of overloaded 'append(long unsigned int&)' is ambiguous
     }
                                                ^
In file included from C:\Users\Ed\IDE 2.0 Sketches-Libraries\Pump_House_Monitor_ver8J\hashtag_includes.h:6,
                 from C:\Users\Ed\IDE 2.0 Sketches-Libraries\Pump_House_Monitor_ver8J\Pump_House_Monitor_ver8J.ino:17:
c:\Users\Ed\IDE 2.0 Sketches-Libraries\libraries\StackString\src/StackString.hpp:83:6: note: candidate: 'void Stack::StackString<LENGTH>::append(char) [with int LENGTH = 50]'
 void StackString<LENGTH>::append(const char character)
      ^~~~~~~~~~~~~~~~~~~
c:\Users\Ed\IDE 2.0 Sketches-Libraries\libraries\StackString\src/StackString.hpp:92:6: note: candidate: 'void Stack::StackString<LENGTH>::append(int) [with int LENGTH = 50]'
 void StackString<LENGTH>::append(int number)
      ^~~~~~~~~~~~~~~~~~~
C:\Users\Ed\IDE 2.0 Sketches-Libraries\Pump_House_Monitor_ver8J\Pump_House_Monitor_ver8J.ino:340:48: error: call of overloaded 'append(long unsigned int&)' is ambiguous
   }
                                                ^
In file included from C:\Users\Ed\IDE 2.0 Sketches-Libraries\Pump_House_Monitor_ver8J\hashtag_includes.h:6,
                 from C:\Users\Ed\IDE 2.0 Sketches-Libraries\Pump_House_Monitor_ver8J\Pump_House_Monitor_ver8J.ino:17:
c:\Users\Ed\IDE 2.0 Sketches-Libraries\libraries\StackString\src/StackString.hpp:83:6: note: candidate: 'void Stack::StackString<LENGTH>::append(char) [with int LENGTH = 50]'
 void StackString<LENGTH>::append(const char character)
      ^~~~~~~~~~~~~~~~~~~
c:\Users\Ed\IDE 2.0 Sketches-Libraries\libraries\StackString\src/StackString.hpp:92:6: note: candidate: 'void Stack::StackString<LENGTH>::append(int) [with int LENGTH = 50]'
 void StackString<LENGTH>::append(int number)
      ^~~~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
  Used: C:\Users\Ed\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\libraries\WiFi
  Not used: C:\Users\Ed\IDE 2.0 Sketches-Libraries\libraries\WiFiNINA
exit status 1

Compilation error: call of overloaded 'append(long unsigned int&)' is ambiguous

It is the lines with "current_pump_cycle_sec" & "current_pump_cycle_min" that is
generating the error. I am using signed and unsigned long in the UNO sketch that compiles w/o an error.

ESP32 Sketch code:

if (c == '\n')  //     && currentLineIsBlank)
        {
          client.println();
          client.println();
          StackString<50> AString = StackString<50>("                      Pump House");
          client.println(AString.c_str());
          StackString<50> BString = StackString<50>("                      **********");
          client.println(BString.c_str());
          client.println();
          client.println();
          StackString<50> HString = StackString<50>("                  Pump Status =  ");
          HString.append(Pump_Status);
          client.println(HString.c_str());
          client.println();
          StackString<50> KString = StackString<50>(" Current Pump Cycle [seconds] =  ");
          KString.append(current_pump_cycle_sec);
          client.println(KString.c_str());
          client.println();
          client.println();
          StackString<50> LString = StackString<50>(" Current Pump Cycle [minutes] =  ");
          LString.append(current_pump_cycle_min);
          client.println(LString.c_str());
          client.println();
          client.println();
          StackString<50> CString = StackString<50>("              Pump House Temp =  ");
          CString.append(sp_temp_1);
          client.println(CString.c_str());
          client.println();
          client.println();
          StackString<50> IString = StackString<50>("               Building Alarm =  ");
          IString.append(Bldg_Alarm);
          client.println(IString.c_str());
          client.println();
          client.println();
          StackString<50> JString = StackString<50>("  Audible Alarm/Pump Shutdown =  ");
          JString.append(Alm_Relay);
          client.println(JString.c_str());
          client.println();
          client.println();
          StackString<50> DString = StackString<50>("          Temp Alarm Setpoint =  ");
          DString.append(Low_Tmp_Alm);
          client.println(DString.c_str());
          client.println();
          client.println();
          StackString<50> EString = StackString<50>("               Low Temp Alarm =  ");
          EString.append(Temp_Alm);
          client.println(EString.c_str());
          client.println();
          client.println();
          StackString<50> FString = StackString<50>("           Low Pressure Alarm =  ");
          FString.append(Pressure_Alm);
          client.println(FString.c_str());
          client.println();
          client.println();
          StackString<50> GString = StackString<50>("           Pump Runtime Alarm =  ");
          GString.append(Pump_Alm);
          client.println(GString.c_str());
          break;
        }

From ESP32 defintion file constants.h:

static uint32_t max_pump_runtime = 600000;  // 10 minutes maximum run time before an alarm
unsigned long current_pump_cycle = 0;
unsigned long current_pump_cycle_sec = 0;
unsigned long current_pump_cycle_min = 0;
unsigned long pump_runtime_hours = 0;
unsigned long pump_daily_run_hrs = 0;

Man that first warning is a big one. Have you considered the possibility that it might be right?

Undeniably.
I was hoping someone might offer an insight into this particular instance as Stackstring works fine with the ESP doing things like passing boolean values.

Look in StackString.hpp. You'll see these are the overloads for the append() function:

    void append(const char* string);
    void append(const char character);
    void append(int number);

You're trying to hand the function an 'unsigned long' and the compiler doesn't know what to do with it.

Check the compilation on the UNO Wifi Rev2 with the IDE preferences set to display all warnings, you will likely see the same lines flagged with warnings instead of errors. At least for the sketches I've compiled on an ESP8266, the compiler options used are not as lenient as with the AVR board packages.

I went back and just defined the value as a "signed int" and it was as happy with that. Evidently "unsigned" is problematic when it parses the value. Appreciate your input. :+1: :+1:

Nothing to do with "parsing". C++ is a strongly typed language. You tried to call a function with an argument of type 'unsigned long'. However a function of that name taking an argument of that type did not exisit.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.