When i link my program, i have this error :
(i have a main.cpp with an entry named void app_main())
c:/users/josem/.platformio/packages/toolchain-xtensa32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32doit-devkit-v1\esp-idf\freertos\libfreertos.a(port_common.o):(.literal.main_task+0x14): undefined reference to app_main' c:/users/josem/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32doit-devkit-v1\esp-idf\freertos\libfreertos.a(port_common.o): in function main_task’:
C:\Users\josem.platformio\packages\framework-espidf\components\freertos\port/port_common.c:129: undefined reference to `app_main’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32doit-devkit-v1\firmware.elf] Error 1
This is the correct solution, but for folks confused by the past-tense phrase:
“You wrote it…”
change that to:
“You need to write it…”
That might clarify the answer… Thanks maxgerhardt for the answer.
[build] /home/mongoq/.platformio/packages/toolchain-xtensa-esp32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld: esp-idf/freertos/libfreertos.a(port_common.c.obj):(.literal.main_task+0x1c): undefined reference to `app_main’
[build] /home/mongoq/.platformio/packages/toolchain-xtensa-esp32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld: esp-idf/freertos/libfreertos.a(port_common.c.obj): in function `main_task’:
[build] /home/mongoq/.platformio/packages/framework-espidf/components/freertos/port/port_common.c:122: undefined reference to `app_main’
[build] collect2: error: ld returned 1 exit status