nasser/arduino.tmbundle — Issue #18: Sketches using String do not compile
Author: grahamb
Created: 2012-01-05 04:20:44+00:00
State: open

It appears that sketches using the String object do not compile. The following compiles fine in the Arduino editor (1.0), but fails in TextMate:

```C
String test = "test";

void setup() {}
void loop() {}
```

This fails to build in TextMate with the following output:
```
# Here is the "preprocessing".
# It creates a .cpp file based with the same name as the .ino file.
# On top of the new .cpp file comes the WProgram.h header.
# and prototypes for setup() and Loop()
# Then the .cpp file will be compiled. Errors during compile will
# refer to this new, automatically generated, file.
# Not the original .ino file you actually edit...
test -d applet || mkdir applet
echo '#include "Arduino.h"' > applet/biebduino.cpp
echo 'void setup();' >> applet/biebduino.cpp
echo 'void loop();' >> applet/biebduino.cpp
cat biebduino.ino >> applet/biebduino.cpp
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -DF_CPU=16000000L -DARDUINO=100 -I/Users/grahamb/Dropbox/code/personal/biebduino -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROM/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/LiquidCrystal/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/SD/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/SD/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/SPI/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/SoftwareSerial/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Stepper/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/utility/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Ethernet/utility/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/SD/utility/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/SD/utility/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/SD/utility/ -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/ -I/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard -mmcu=atmega328p applet/biebduino.cpp -o applet/biebduino.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-gcc -Os -lm -Wl,--gc-sections -mmcu=atmega328p -o applet/biebduino.elf applet/biebduino.o applet/core.a
applet/biebduino.o: In function `__static_initialization_and_destruction_0': /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:10: undefined reference to `String::String(char const*)' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:48: undefined reference to `String::String(char const*)' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:48: undefined reference to `String::String(char const*)' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:48: undefined reference to `String::String(char const*)' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:48: undefined reference to `String::String(char const*)' applet/biebduino.o:/Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:48: more undefined references to `String::String(char const*)' follow applet/biebduino.o: In function `__static_initialization_and_destruction_0': /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:48: undefined reference to `String::~String()' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:10: undefined reference to `String::~String()' applet/biebduino.o: In function `test()': /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:65: undefined reference to `String::String(char const*)' applet/biebduino.o: In function `StringSumHelper': /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:195: undefined reference to `String::String(char const*)' applet/biebduino.o: In function `test()': /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:66: undefined reference to `operator+(StringSumHelper const&, String const&)' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:66: undefined reference to `String::operator=(String const&)' applet/biebduino.o: In function `~StringSumHelper': /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:192: undefined reference to `String::~String()' applet/biebduino.o: In function `test()': /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:70: undefined reference to `String::operator=(char const*)' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:79: undefined reference to `String::operator=(char const*)' /Users/grahamb/Dropbox/code/personal/biebduino/applet/biebduino.cpp:93: undefined reference to `String::~String()' applet/core.a(Print.o): In function `Print::print(String const&)': /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.cpp:58: undefined reference to `String::operator[](unsigned int) const' make: *** [applet/biebduino.elf] Error 1
```