Hi everybody!
First of all, so thankful for this forum. It appears like a really supportive community.
Here’s my problem today: compiling my main.cpp for a fairly involved project, file structure below. I’ve tried swapping out my main.cpp for something simple like:
#include <Arduino.h>
void setup() {
Serial.begin(115200);
Serial.println(“Setup running”);
}
void loop() {
Serial.println(“Loop running”);
delay(1000);
}
But I persistently get these errors:
Scanning dependencies…
Dependency Graph
|-- AsyncTCP-esphome @ 2.1.4
|-- ESPAsyncWebServer-esphome @ 3.3.0
|-- ArduinoJson @ 7.3.1
|-- WebSockets @ 2.6.1
|-- SPIFFS @ 2.0.0
Building in debug mode
Linking .pio\build\esp32dev\firmware.elf
c:/users/rober/.platformio/packages/toolchain-xtensa-esp32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libFrameworkArduino.a(main.cpp.o):(.literal._Z8loopTaskPv+0x8): undefined reference to setup()' c:/users/rober/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libFrameworkArduino.a(main.cpp.o):(.literal._Z8loopTaskPv+0xc): undefined reference to
loop()’
c:/users/rober/.platformio/packages/toolchain-xtensa-esp32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libFrameworkArduino.a(main.cpp.o): in function loopTask(void*)': C:/Users/rober/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:42: undefined reference to
setup()’
c:/users/rober/.platformio/packages/toolchain-xtensa-esp32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: C:/Users/rober/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:48: undefined reference to `loop()’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1
================================================================================= [FAILED] Took 18.84 seconds =================================================================================
So I followed the link in the terminal and it takes me to:
C:\Users\rober.platformio\packages\framework-arduinoespressif32\cores\esp32\main.cpp
but it should be compiling the main.cpp here:
C:\Users\rober\OneDrive\Documents\PlatformIO\Projects\ES32A08-SNRv2\src\main.cpp
This is driving me mental. Can anyone possibly advise? Here’s my platform.ini in case it helps:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
esphome/AsyncTCP-esphome@^2.1.4
esphome/ESPAsyncWebServer-esphome@^3.3.0
bblanchon/ArduinoJson@^7.3.1
links2004/WebSockets@^2.6.1
build_src_filter =
+<src/main.cpp> ; Explicitly include src/main.cpp
+<src/web/.cpp> ; Include all .cpp files in src/web/
+<src/ui/.cpp> ; Include all .cpp files in src/ui/ (if any)
+<controllers/.cpp> ; Include all .cpp files in controllers/
+<storage/.cpp> ; Include all .cpp files in storage/
+<web/*.cpp> ; Include all .cpp files in web/ (if outside src/)
board_build.partitions = default.csv
build_type = debug
monitor_speed = 115200
build_flags =
-D CORE_DEBUG_LEVEL=0
Thanks in advance,
Roberto