esp-idf: undefined reference to `app_main' when building project (IDFGH-1318)

----------------------------- Delete below -----------------------------

/home/linux/esp32/esp-idf/examples/get-started/ESP32_RC522/build/esp32/libesp32.a(cpu_start.o)😦.literal.main_task+0x18): undefined reference to app_main' /home/linux/esp32/esp-idf/examples/get-started/ESP32_RC522/build/esp32/libesp32.a(cpu_start.o): In function main_task’: /home/linux/esp32/esp-idf/components/esp32/cpu_start.c:515: undefined reference to `app_main’

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 25 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Did you add: extern "C" void app_main()

Hi @f00bard , that part of the docs is outdated, will fix. main should be treated like any other component, with its own CMakeLists.txt.

I had this issue, with a project called WIFIPart

I solved it for me. NO CAPITAL LETTERS

When I renamed the folder, and all references to the project to wifi_part it compiled.

If you are using Cmake to build your project, make sure your c source filename is included in CMakeLists.txt under the main folder.

set(COMPONENT_SRCS "hello_world_main.c"
                                              "file1.c"
                                              "file2..c")