Using c++ with ESP-IDF for ESP32 development

Add this block to your main.cpp:


extern "C" {
    void app_main(void);
}

Example

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"

extern "C" {
    void app_main(void);
}

void app_main()
{
    printf("Hello PlatformIO!\n");
}
2 Likes