Problem with Platform.io Build - Testing a ESP32 program

Hi there, I am having trouble building a ESP32 program, as the ESP32 library is buggy and refuses to work.

This is the response of when I try to build it:

> Executing task in folder PrototypeV7: C:\Users\Jason\.platformio\penv\Scripts\platformio.exe run <

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB 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-arduinoespressif32 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 52 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <EspSoftwareSerial> 6.12.2
|-- <ESP_WiFiManager> 1.3.0
|   |-- <WiFi> 1.0
|-- <SoftwareSerial> 1.0.0
|-- <ArduinoOTA> 1.0.0+sha.7856de7
|   |-- <WiFi> 1.0
|-- <ESP32 HomeKit SDK for Arduino> 1.1.0
|-- <STM32duino X-NUCLEO-NFC03A1> 1.0.1
|   |-- <SPI> 1.0
|-- <SinricPro_Generic> 2.8.0
|   |-- <ArduinoJson> 6.17.3
|   |-- <WebSockets_Generic> 2.4.1
|   |   |-- <EthernetENC> 2.0.0
|   |   |   |-- <SPI> 1.0
|   |   |-- <Ethernet2> 1.0.4
|   |   |   |-- <SPI> 1.0
|   |   |-- <Ethernet3> 1.5.5
|   |   |   |-- <SPI> 1.0
|   |   |-- <Ethernet> 2.0.0
|   |   |   |-- <SPI> 1.0
|   |   |-- <EthernetLarge> 2.0.0
|   |   |   |-- <SPI> 1.0
|   |   |-- <WiFi> 1.0
|   |   |-- <SPI> 1.0
|   |-- <EthernetENC> 2.0.0
|   |   |-- <SPI> 1.0
|   |-- <Ethernet2> 1.0.4
|   |   |-- <SPI> 1.0
|   |-- <Ethernet3> 1.5.5
|   |   |-- <SPI> 1.0
|   |-- <Ethernet> 2.0.0
|   |   |-- <SPI> 1.0
|   |-- <EthernetLarge> 2.0.0
|   |   |-- <SPI> 1.0
|   |-- <WiFi> 1.0
|-- <CMSIS DSP> 1.0.0+sha.fa8d1f7
|-- <ArduinoJson> 6.17.3
|-- <CR95HF library>
|   |-- <ESP32 BLE Arduino> 1.0.1
|   |-- <SPI> 1.0
|   |-- <WiFi> 1.0
|-- <SPI> 1.0
|-- <WiFi> 1.0
Building in release mode
Compiling .pio\build\esp32dev\src\main.c.o
Compiling .pio\build\esp32dev\lib6df\WiFi\WiFiServer.cpp.o
Compiling .pio\build\esp32dev\lib6df\WiFi\WiFiUdp.cpp.o
Archiving .pio\build\esp32dev\libe41\libESP_WiFiManager.a
In file included from src\main.c:20:0:
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.h:30:1: error: unknown type name 'class'
 class SPISettings
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.h:31:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 
 {
 ^
In file included from src\main.c:20:0:
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.h:40:1: error: unknown type name 'class'
 class SPIClass
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.h:41:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 
 {
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.h:88:8: error: unknown type name 'SPIClass'
 extern SPIClass SPI;
        ^
In file included from C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/Print.h:27:0,
                 from C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFi.h:27,
                 from src\main.c:21:
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/Printable.h:25:1: error: unknown type name 'class'
 class Print;
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/Printable.h:33:1: error: unknown type name 'class'
 class Printable
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/Printable.h:34:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 
 {
 ^
In file included from C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFi.h:27:0,
                 from src\main.c:21:
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/Print.h:34:1: error: unknown type name 'class'
 class Print
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/Print.h:35:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
In file included from C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFi.h:28:0,
                 from src\main.c:21:
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPAddress.h:29:1: error: unknown type name 'class'
 class IPAddress: public Printable
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPAddress.h:29:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
 class IPAddress: public Printable
                ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPAddress.h:94:7: error: unknown type name 'IPAddress'
 const IPAddress INADDR_NONE(0, 0, 0, 0);
       ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPAddress.h:94:29: error: expected declaration specifiers or '...' before numeric constant 
 const IPAddress INADDR_NONE(0, 0, 0, 0);
                             ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPAddress.h:94:32: error: expected declaration specifiers or '...' before numeric constant 
 const IPAddress INADDR_NONE(0, 0, 0, 0);
                                ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPAddress.h:94:35: error: expected declaration specifiers or '...' before numeric constant
 const IPAddress INADDR_NONE(0, 0, 0, 0);
                                   ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPAddress.h:94:38: error: expected declaration specifiers or '...' before numeric constant 
 const IPAddress INADDR_NONE(0, 0, 0, 0);
                                      ^
In file included from C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFi.h:29:0,
                 from src\main.c:21:
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPv6Address.h:29:1: error: unknown type name 'class'
 class IPv6Address: public Printable
 ^
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\cores\esp32/IPv6Address.h:29:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
 class IPv6Address: public Printable
                  ^
In file included from C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFiSTA.h:28:0,
                 from C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFi.h:32,
                 from src\main.c:21:
C:\Users\Jason\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFiGeneric.h:28:22: fatal error: functional: No such file or directory
compilation terminated.
Compiling .pio\build\esp32dev\libdbd\SoftwareSerial\SoftwareSerial.cpp.o
*** [.pio\build\esp32dev\src\main.c.o] Error 1
.pio\libdeps\esp32dev\SoftwareSerial\SoftwareSerial.cpp:41:27: fatal error: avr/interrupt.h: No such file or directory
compilation terminated.
*** [.pio\build\esp32dev\libdbd\SoftwareSerial\SoftwareSerial.cpp.o] Error 1
===================================================================== [FAILED] Took 43.32 seconds =====================================================================
The terminal process "C:\Users\Jason\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Please help.

Thank you!

Here is what it looks like on my screen

Eh, there are quite a few things that don’t make sense here at all.

You are building for an ESP32 board yet you’re including libraries meant for ARM-type processors and specifically STM32 ones. That can’t possibly work since they’re meant for different processors types.

You have named your main source file main.c, and as thus it will be using the C language. Then you attempt to include Arduino libraries, which are written in C++ – this won’t work, C code can’t understand C++ specific keywords. You need to be having a main.cpp for this to work.

I’d suggest taking one small step at a time – first build and upload a small blinky example to confirm everything’s working, then add one library at time to the project and keep building up that way.