velxio/backend/app/services/esp-idf-template
David Montero 21791a8237 fix(espidf): drop textual #include "sketch.ino.cpp" in main wrapper
Now that main/CMakeLists.txt globs every *.cpp/*.c into SRCS (commit
27c9a28 — needed so multi-file Arduino projects link), sketch.ino.cpp
is compiled as its own translation unit. The template main.cpp's
`#include "sketch.ino.cpp"` is left over from when SRCS only named
main.cpp — back then we had to pull the user code into main.cpp's TU
to get it compiled at all.

With the glob in place, keeping the include re-defines setup() and
loop() in main.cpp's TU AND in sketch.ino.cpp.obj, so the linker dies
with "multiple definition of `setup'". Replace the include with a
forward declaration and let the linker resolve setup()/loop() from
sketch.ino.cpp.obj. Matches arduino-cli's per-file compile + auto-link
model, and frees pure-C++ multi-file sketches to put helper TUs in
their own .cpp files without textual-include hacks.

Repro: robot-desktop-eyes after the glob fix (#13 rebuild) — compile
got past resolve+compile and into link, where multi-def of setup()
would have appeared on the next attempt. This commit closes the loop.
2026-05-23 17:41:21 +02:00
..
main fix(espidf): drop textual #include "sketch.ino.cpp" in main wrapper 2026-05-23 17:41:21 +02:00
CMakeLists.txt feat: enhance Arduino library handling by detecting external libraries and creating IDF components, add tests for library resolution logic 2026-04-07 14:59:51 -03:00
partitions.csv feat: add ESP32 WiFi/BLE emulation with ESP-IDF compilation pipeline 2026-03-31 20:53:56 -03:00
sdkconfig.defaults fix(espidf): enable mbedTLS PSK so ssl_client.cpp links 2026-05-14 12:38:20 -03:00
sdkconfig.defaults.in feat(compile): ESP-IDF compile options + request dedup 2026-05-18 21:50:45 -03:00