I’m not sure if this is expected to work or not, but I’ve been attempting to use the STL string. This is the isolated sample I’ve gotten to fail. Can anyone set my expectations or point out what I’m missing?
I setup my directory with platformio init -b huzzah -d . --ide atom
. I created this snippet at ./src/test.cpp
:
#include <Arduino.h>
#include <string>
void setup()
{
std::string("something");
}
void loop()
{
}
I compiled with platformio run
and get the following output:
[11:42:33] 1 $ platformio run
[Fri Jun 10 11:42:47 2016] Processing huzzah (platform: espressif, board: huzzah, framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
xtensa-lx106-elf-g++ -o .pioenvs/huzzah/src/test.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -MMD -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -DARDUINO=20200 -DPLATFORMIO=020905 -U__STRICT_ANSI__ -I/Users/mg/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/mg/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I.pioenvs/huzzah/FrameworkArduino -I.pioenvs/huzzah/FrameworkArduinoVariant -Isrc src/test.cpp
xtensa-lx106-elf-g++ -o .pioenvs/huzzah/firmware.elf -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy -Wl,-T"esp8266.flash.4m1m.ld" .pioenvs/huzzah/src/test.o -L/Users/mg/.platformio/packages/framework-arduinoespressif/tools/sdk/lib -L/Users/mg/.platformio/packages/ldscripts -L.pioenvs/huzzah -Wl,--start-group .pioenvs/huzzah/libFrameworkArduinoVariant.a .pioenvs/huzzah/libFrameworkArduino.a -lmesh -lwpa2 -lsmartconfig -lpp -lmain -lwpa -llwip -lnet80211 -lwps -lcrypto -lphy -lhal -laxtls -lgcc -lm -Wl,--end-group
.pioenvs/huzzah/src/test.o:(.text.setup+0x4): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
.pioenvs/huzzah/src/test.o:(.text.setup+0x8): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
.pioenvs/huzzah/src/test.o: In function `setup':
test.cpp:(.text.setup+0x18): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
test.cpp:(.text.setup+0x20): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
collect2: error: ld returned 1 exit status
scons: *** [.pioenvs/huzzah/firmware.elf] Error 1
======================================================================================= [ ERROR ] Took 1.17 seconds =======================================================================================