IDE on Raspberry gives compile errors

I try to compile the following program voor running on a NANO on a IDE running on a Raspberry PI4.
It gives errors while compiling.
When Compiling on a IDE on a LINUX MINT all is ok.

void setup()
{
Serial.begin(9600);
}

void loop()
{
String outString;
float p = 12.23;
float q = 56.78;
outString = 'BS' + String(p) + 'S' + String(q) + 'S';
Serial.println(outString);

Version IDE on Mint is 1.8.19
Version in Raspberry is: 2.1.0.5 + dfsg -4.1

Do we need to guess the error?

Do you actually have those single quotes in the code?

Should be double quotes for anything more than a single character. If you set preferences to show all compiler warnings you will see that in both versions of the IDE.

The OPs code also has no closing brace on the loop!

I made the source a bit more simple.
This still gives the error with the PI IDE.

void setup()
{
Serial.begin(9600);
}

void loop()
{
String outString;
float p = 12.34;

outString = "BS" + String(p);

Serial.println(outString);

}

The error:

sketch_oct21a.ino: In function ‘void loop()’:
sketch_oct21a.ino:11:32: error: call of overloaded ‘String(float&)’ is ambiguous
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:192:0,
from sketch_oct21a.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:70:11: note: candidate: String::String(long unsigned int, unsigned char)
explicit String(unsigned long, unsigned char base=10);
^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:69:11: note: candidate: String::String(long int, unsigned char)
explicit String(long, unsigned char base=10);
^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:68:11: note: candidate: String::String(unsigned int, unsigned char)
explicit String(unsigned int, unsigned char base=10);
^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:67:11: note: candidate: String::String(int, unsigned char)
explicit String(int, unsigned char base=10);
^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:66:11: note: candidate: String::String(unsigned char, unsigned char)
explicit String(unsigned char, unsigned char base=10);
^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:65:11: note: candidate: String::String(char)
explicit String(char c);
^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:60:2: note: candidate: String::String(const String&)
String(const String &str);
^

As far I know, that version is antique and therefore the WString implementation might not support floats; the list of candidates seems to indicate that.

I don't know if the Linux version on https://www.arduino.cc/en/software will work on the Pi. If not, a solution might be to copy WString.h and WString.cpp from your Mint system to the Pi (replacing the originals); make backups if needed.

Unfortunately, official builds of Arduino IDE 2.x for Linux ARM hosts are not yet available.

However, the one you get from the "Linux ARM" download links (I believe the RPi 4 is usually running a 64 bit operating system, in which case use that link instead of the "32 bits" one) under the "Legacy IDE (1.8.X)" section lower down on the Software page will work:

https://www.arduino.cc/en/software#legacy-ide-18x

1.8.19 is a big step up from "2.1.0.5 + dfsg -4.1" (which is a slightly modified version of Arduino IDE 1.0.5 from 2013).

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