Closed Zackh1998 closed 5 years ago
It might be worth noting that the following code compiles, links, and actually runs and produces expected output on a teensy board:
#include <Arduino.h>
#include <functional>
void test() {
Serial.println("test");
}
void setup()
{
}
void loop() {
std::function<void()> _test = test;
test();
}
Hmm, it seems that adding the following line in platformio.ini fixed it.
build_flags = -llibc -lc
I've reduced a linker error in one of my projects to the following piece of code:
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:
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 statusAny idea what's happening here?