Issues with linking to firmware.elf

Hello!
So I’ve run in a bit of an issue with the merging and linking of the firmware.elf file.
This happens with any program I try to build and upload.
I’d really appreciate some help or explanation on how this happens.
Thanks in advance!

Program(just a basic hello-world for testing essentially ):

#include <Arduino.h>

#define LED 2

void setup() {
  Serial.begin(115200);
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  Serial.println("LED is on");
  delay(1000);
  digitalWrite(LED, LOW);
  Serial.println("LED is off");
  delay(1000);
}

Error message:

Processing espwroom32 (platform: espressif32; framework: arduino; board: upesy_wroom)
--------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/upesy_wroom.html
PLATFORM: Espressif 32 (6.4.0) > uPesy ESP32 Wroom DevKit
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Linking .pio\build\espwroom32\firmware.elf
c:/users/chris/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\espwroom32\src\radar.cpp.o: in function `setup()':
C:\Users\Chris\Documents\PlatformIO\Projects\Radar-Demo/src/radar.cpp:5: multiple definition of `setup()'; .pio\build\espwroom32\src\main.cpp.o:C:\Users\Chris\Documents\PlatformIO\Projects\Radar-Demo/src/main.cpp:5: first defined here
c:/users/chris/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\espwroom32\src\radar.cpp.o: in function `loop()':
C:\Users\Chris\Documents\PlatformIO\Projects\Radar-Demo/src/radar.cpp:10: multiple definition of `loop()'; .pio\build\espwroom32\src\main.cpp.o:C:\Users\Chris\Documents\PlatformIO\Projects\Radar-Demo/src/main.cpp:10: first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\espwroom32\firmware.elf] Error 1

if you need any further information, i’ll hopefully answer within a few minutes
Thanks!

The error message very clearly says that you have a project that tries to define the loop and setup functions in two files: src/main.cpp and src/radar.cpp.

Since both files are by-default compiled, they conflict with each other, since there can only be one definition of the functions.

If you don’t want the code from radar.cpp or the other file, either delete or rename it radar.txt.

oh my god im stupid, thanks!
clearly the ability to read is advantageous :slight_smile: