ESP32 SNTP example doesn't work, but works using make without platformio

Hey everyone,

I’m trying to get this SNTP code going from github.

See here: esp-idf/examples/protocols/sntp at master · espressif/esp-idf · GitHub

I have a firebeetle esp32, I created a new platformio project and set the framework to esp-idf.

I then pasted the main code from the github into a main.c in the platformio project.

Here is the console output during build:

Processing firebeetle32 (platform: espressif32; board: firebeetle32; framework: espidf)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/firebeetle32.html
PLATFORM: Espressif 32 > FireBeetle-ESP32
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, tump
a)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)

Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/firebeetle32/src/main.o
src/main.c:24:29: fatal error: /lwip/apps/sntp.h: No such file or directory
compilation terminated.
Compiling .pioenvs/firebeetle32/bootloader/bootloader_support/src/esp_image_format.o
Compiling .pioenvs/firebeetle32/bootloader/bootloader_support/src/flash_encrypt.o
*** [.pioenvs/firebeetle32/src/main.o] Error 1
Compiling .pioenvs/firebeetle32/bootloader/bootloader_support/src/flash_partitions.o
========================== [ERROR] Took 4.77 seconds ==========================

So Finally if I run the code with make without using platformio, it works perfectly. The IDF_PATH, etc is set up correctly and I have been working with platformio and have successfully connected to wifi, used http/https and sdio.

It feels like I’m missing something in the platformio.ini that might be defined using make menuconfig.

Any help will really be appreciated!

Please try

#include "apps/sntp/sntp.h"

instead of

#include "lwip/apps/sntp.h"

in your code.

1 Like

Thank you so much. I appreciate the help!