PlatformIO on VSCode not compiling: collect2.exe: error: ld returned 1 exit status
Asked Answered
L

1

7

I recently had to wipe my computer and after getting everything up and running it was time to open up some ESP32 programs I was working on before and found that Platform IO on VSCode would no longer compile. After running through the compiler I get the following error:

Compiling .pio\build\esp32dev\FrameworkArduino\stdlib_noniso.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\esp32dev\libFrameworkArduino.a
Linking .pio\build\esp32dev\firmware.elf
c:/users/lloyd/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find -lstdc++
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1
=========================================================================== [FAILED] Took 11.91 seconds ===========================================================================
The terminal process "C:\Users\lloyd\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

I started to debug and realized that even with the most simple program it wont compile. I tried the Arduino IDE and that works fine, as well as some examples that use CMaker and those too work. But when I try to upload the following code:


void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop()
{
  // put your main code here, to run repeatedly:
  Serial.print("Hello World");
}

with this platoformio.ini:

platform = espressif32
framework = arduino
board = esp32dev
monitor_speed = 115200

I get the same collect2.exe: error: ld returned 1 exit status

Anyone know whats going on or whats changed since I reset my computer?

Luckless answered 10/11, 2020 at 23:19 Comment(1)
Did you ever solve this?Bighead
B
5

Found Answer on PlatformIo Forums finally. Answering here in case others come looking here first like I did.

Remove the folder:

c:/users/<username>/.platformio/packages/toolchain-xtensa

and restart build.

Bighead answered 12/2, 2021 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.