velxio/backend/app/services/esp-idf-template/main
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
..
CMakeLists.txt fix(espidf): glob all main/*.cpp /*.c so helper TUs link 2026-05-23 17:30:29 +02:00
main.c
main.cpp fix(espidf): drop textual #include "sketch.ino.cpp" in main wrapper 2026-05-23 17:41:21 +02:00
velxio_compat.h fix(esp32/ledc): translate ledcWrite(pin,duty) → ledcWrite(channel,duty) 2026-05-22 16:14:55 +02:00