Missing paths with WifiManager.h on ESP32 w/ Arduino

Hi!
I am trying to compile a simple program using the Wifimanager library but there are some missing dependencies, a bunch of #include’s are not working in the WifiManager file.

After finding this thread I set my platformio.ini this way:

lib_deps =
    Wire
    https://github.com/tzapu/WiFiManager.git
    ; https://github.com/tzapu/WiFiManager.git@^2.0.5-beta ; ESP32 wifi credentials portal

Ive tried both versions but no difference. I get an error

In file included from src\main.cpp:3:0:
.pio\libdeps\esp32thing_plus\WiFiManager/WifiManager.h:153:37: fatal error: esp_arduino_version.h: No such file 
or directory

This is under the section

#ifdef Arduino_h
    #ifdef ESP32

of the wifimanager.h file so its a good sign, but where am I supposed to find the dependencies to those missing files? Seems like they have to do with esp32 arduino library, but I cant find anything online…
Thanks!!

This file exists in Arduino-ESP32 since 2.0.0:

If you get the error, this shows that you haven’t updated your Espressif32 platform or are forcing an older version in the platformio.ini. Per Releases · platformio/platform-espressif32 · GitHub, try explicity setting platform = espressif32@5.2.0 to get Arduino-ESP32 2.0.5 which of course includes that file.

If you want to update your existing installation, you can for example do it via the PIO Home GUI or the CLIpio pkg update -g -p espressif32.

1 Like

As always, you are here to save the day. Thank you so much!

Update: It fixed the issue when testing in a small project, but I still get this error in my main project:

Building .pio\build\esp32thing_plus\bootloader.bin
Generating partitions .pio\build\esp32thing_plus\partitions.bin
esptool.py v4.2.1
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Compiling .pio\build\esp32thing_plus\libeb1\Wire\Wire.cpp.o
Compiling .pio\build\esp32thing_plus\lib4fa\WiFi\WiFi.cpp.o
Compiling .pio\build\esp32thing_plus\lib4fa\WiFi\WiFiAP.cpp.o
In file included from src/test/main_WifiManager.cpp:4:
.pio/libdeps/esp32thing_plus/WiFiManager/WiFiManager.h:87:14: fatal error: Update.h: No such file or directory

I wonder if I need to uninstall stuff since its an older project? I tried deleting the libdeps wifimanager folder but after it reinstalls it the same error occurs…

My next step would be do delete everything from platformIO but I am not too sure where all of the cached data for the extension is located…

Does the dependency graph at the beginning of the project detect a dependency from WiFiManager to the Update library? Have you tried removing the .pio folder to force a clean redowload of the libraries?

Yes it does, and I tried deleting the .pio folder but no success :frowning:

I tried removing all my source and header files except main.cpp, and removed all libraries from lib_deps except for WifiManager.h to see if I could isolate the problem, and now I get Wifi.h: no such file or directory so I wonder if this may mean my arduino-espressif32 core is corrupted.

So I tried updating it with these commands

pio upgrade --dev
pio platform update espressif32

But still Wifi.h isn’t found

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32thing_plus.html
PLATFORM: Espressif 32 (5.2.0) > SparkFun ESP32 Thing Plus
HARDWARE: ESP32 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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.20005.220925 (2.0.5)
 - tool-esptoolpy @ 1.40201.0 (4.2.1) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wire @ 2.0.0
|-- WiFiManager @ 2.0.13-beta+sha.476952c
Building in release mode
Compiling .pio\build\esp32thing_plus\src\test\main_WifiManager.cpp.o
Building .pio\build\esp32thing_plus\bootloader.bin
Generating partitions .pio\build\esp32thing_plus\partitions.bin
esptool.py v4.2.1
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Compiling .pio\build\esp32thing_plus\libeb1\Wire\Wire.cpp.o
Compiling .pio\build\esp32thing_plus\libd10\WiFiManager\WiFiManager.cpp.o
In file included from .pio/libdeps/esp32thing_plus/WiFiManager/WiFiManager.cpp:13:
.pio/libdeps/esp32thing_plus/WiFiManager/WiFiManager.h:85:14: fatal error: WiFi.h: No such file or directory

**************************************************************
* Looking for WiFi.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:WiFi.h"
* Web  > https://registry.platformio.org/search?q=header:WiFi.h
*
**************************************************************

     #include <WiFi.h>
              ^~~~~~~~
compilation terminated.
Compiling .pio\build\esp32thing_plus\FrameworkArduino\Esp.cpp.o
Compiling .pio\build\esp32thing_plus\FrameworkArduino\FirmwareMSC.cpp.o
*** [.pio\build\esp32thing_plus\libd10\WiFiManager\WiFiManager.cpp.o] Error 1
========================================= [FAILED] Took 12.95 seconds =========================================

This is my .ini file …

[env:esp32thing_plus]
framework = arduino
board = esp32thing_plus
platform = espressif32
monitor_filters = esp32_exception_decoder

lib_deps = 
	Wire ; Required for Wifi.h https://community.platformio.org/t/why-is-wifi-h-not-found-by-compiler/21641/12
	https://github.com/tzapu/WiFiManager.git

I wonder if you know something I don’t? Maybe there is another way I can investigate if my arduino / esp32 core is corrupt? But I doubt it’s actially the case because if I create a new project within PIO with a ESP32 as target board (the same as my current failing project), it actually compiles…

Thanks again for your help…

The project uses conditional defines.

So try setting

lib_ldf_mode = chain+

(docs)

I put your 1st comment as solution as this is what solved the original issue. But for my project I was struggling with, It is because the source file that included WifiManager.h was in a directory called src/test and it appears like it could not include it properly. I ended up just moving it to src and it builds fine…
Thank you for your help, I still learned about a few PIO commands and .ini settings because of this!