I'm using PlatformIO (with the VS Code extension), on Windows 10, and am compiling for the Teensy 3.5 board.
I've reduced a linker error in one of my projects to the following piece of code:
#include <Arduino.h>
#include <functional>
void setup()
{
// Serial.println();
std::function<void()> func;
func();
}
void loop() {}
When I try to compile and link this, it compiles fine, but fails to link. If i uncomment the Serial.println(), then it links and compiles.
I am using the following settings in the platformio.ini file:
[env:teensy35]
platform = teensy
board = teensy35
framework = arduino
The error it gives when failing to link is:
c:/users/zackh/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc.a(lib_a-writer.o): In function _write_r':
writer.c:(.text._write_r+0x12): undefined reference to
_write'
collect2.exe: error: ld returned 1 exit status
Any idea what's happening here?