if (comma != -1) {
String val = number.substring(comma + 1);
value = val.toFloat();
number = number.substring(0, comma); <- online compile gives an error, local not!
}
This fails too:
String numb;
if (comma != -1) {
String val = number.substring(comma + 1);
value = val.toFloat();
numb = number.substring(0, comma); <- online compile gives an error, local not!
}
The error the online compiler generates is: undefined reference to `String::operator=(String&&)
How about that!
This works:
if (comma != -1) {
String val = number.substring(comma + 1);
value = val.toFloat();
String numb = number.substring(0, comma); <- online compile: succes!
}
Is the HAL branch ment for local compiling, than the answer must be no, I use the code I downloaded a couple of months ago.
But to be clear, locally it compiles fine.
I don’t think so, I used the download and install locally tutorial a long time a go.
The GIT plugin is installed but grayed out… I never used it to honest.
ok this line of code fails to compile online:
number = number.substring(0, comma);
This is what I use locally:
arm-none-eabi-g++ (GNU Tools for ARM Embeddee) [ARM/embedded-4_8-branch revision 208322]
The method for the assignment statement you are doing, a reference to String is replaced by a reference to another String (substring always returns a new String) is actually ifdef’ed in the source controlled by #ifdef __GXX_EXPERIMENTAL_CXX0X__.
This experimental flag must be turned ON in your local GCC install and it is off in the cloud compile.
BKO, Thanks for the info, it’s not a big deal, but this behavior just tickled my curiosity.
tried this: #defineGXX_EXPERIMENTAL_CXX0X
//next line for testing online versus off line compiling
number = number.substring(0, comma);
And the reply of the online compiler is:
hemko-0.5.cpp:193:0: warning: “GXX_EXPERIMENTAL_CXX0X” redefined [enabled by default]
^ :0:0: note: this is the location of the previous definition
hemko-0.5.o: In function button_press(String)': /spark/compile_server/shared/workspace/3_compile-server2/core-firmware/build/hemko-0.5.cpp:195: undefined reference toString::operator=(String&&)'
collect2: error: ld returned 1 exit status
make: *** [c3765d3fc76754eb87eeb544791192d49464e34e96fe9ccf31ab11652db8.elf] Error 1
Again no big deal, I use another string now. And that works off course!