Weird linker error with esp32

Hi i freshly installed PlatformIO as an plugin into my VSCode. i wanted to try programming an esp32 with the esp-IDF it downloaded the framework fine and installed the toolchain but when i try to build an example programm from esp it throws a linker error:

Processing az-delivery-devkit-v4 (platform: espressif32; board: az-delivery-devkit-v4; framework: espidf)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 1.12.0 > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 16MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-espidf 3.40000.200303 (4.0.0) 
 - tool-cmake 3.16.4 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - tool-ninja 1.7.1 
 - toolchain-esp32ulp 1.22851.190618 (2.28.51) 
 - toolchain-xtensa32 2.80200.200226 (8.2.0)
Reading CMake configuration...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/az-delivery-devkit-v4/esp-idf/src/empty.c.o
Generating LD script .pio/build/az-delivery-devkit-v4/esp32_out.ld
Generating partitions .pio/build/az-delivery-devkit-v4/partitions.bin
Compiling .pio/build/az-delivery-devkit-v4/esp-idf/app_trace/app_trace.c.o
Compiling .pio/build/az-delivery-devkit-v4/esp-idf/app_trace/app_trace_util.c.o
Compiling .pio/build/az-delivery-devkit-v4/esp-idf/app_trace/host_file_io.c.o
.
.
Compiling and indexing a bunch of stuff...
.
.
Indexing .pio/build/az-delivery-devkit-v4/bootloader/esp-idf/xtensa/libxtensa.a
Linking .pio/build/az-delivery-devkit-v4/bootloader.elf
Building .pio/build/az-delivery-devkit-v4/bootloader.bin
esptool.py v2.6
Linking .pio/build/az-delivery-devkit-v4/firmware.elf
/root/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/az-delivery-devkit-v4/esp-idf/esp32/libesp32.a(cpu_start.c.o):(.literal.main_task+0x18): undefined reference to `app_main'
/root/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/az-delivery-devkit-v4/esp-idf/esp32/libesp32.a(cpu_start.c.o): in function `main_task':
/root/.platformio/packages/framework-espidf/components/esp32/cpu_start.c:540: undefined reference to `app_main'
collect2: error: ld returned 1 exit status
*** [.pio/build/az-delivery-devkit-v4/firmware.elf] Error 1
============================================================================== [FAILED] Took 43.18 seconds ==============================================================================
The terminal process terminated with exit code: 1

So… what’s your source code / project? There doesn’t seem to be any file implementing the needed app_main() main entry function?

Is this file literally empty?

I solved it, apparently when creating a new project “app_main” is automatically added to CMake…
I didnt check that since it makes no sense to add that automatically…

hi can you help to solve the problem. I’m new to VSCode and PlatformIO.

/esp/esp-idf/components/freertos/app_startup.c:206: undefined reference to `app_main’

I have this error and only this, and also I’m new to Cmake. What should I do, I could not figure it out.

My CMake is like this:

FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/.)

idf_component_register(SRCS ${app_sources})

idf_component_register(SRCS “app_main.cpp”
INCLUDE_DIRS “.”)