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!

Hi. Fish here. Having the same issue with WiFiManager but when I type
" pio pkg update -g -p espressif32" I get the following message:
“UnknownPackageError: Could not find the package with ‘espressif32.’ requirements for your system ‘windows_amd64’”

any idea what that means?

Thanks!
Fish

There is no . in the platform name.

It ran but seems everything was already up to date.

PS C:\Users\Mark\Documents\Source\PlatformIO\DigitalWatch> pio pkg update -g -p espressif32
Platform Manager: espressif32@6.3.2 is already up-to-date
Tool Manager: framework-arduinoespressif32@3.20009.0 is already up-to-date
Tool Manager: tool-esptoolpy@1.40501.0 is
already up-to-date
Tool Manager: tool-mkfatfs@2.0.1 is already up-to-date
Tool Manager: tool-mklittlefs@1.203.210628 is already up-to-date
Tool Manager: tool-mkspiffs@2.230.0 is already up-to-date
Tool Manager: tool-openocd-esp32@2.1100.20220706 is already up-to-date
Tool Manager: toolchain-riscv32-esp@8.4.0+2021r2-patch5 is already up-to-date
Tool Manager: toolchain-xtensa-esp32@8.4.0+2021r2-patch5 is already up-to-date
Tool Manager: toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5 is already up-to-date

Makes sense since I installed like 6 months ago. BUT it is still having an issue with WiFiManager.
When compiling I get:
fatal error: ESP8266WiFi.h: No such file or directory
Compiling .pio\build\lolin_c3_mini\FrameworkArduino\esp32-hal-i2c.c.o
*** [.pio\build\lolin_c3_mini\src\main.cpp.o] Error 1
*** [.pio\build\lolin_c3_mini\lib0f9\WiFiManager\WiFiManager.cpp.o] Error 1
======= [FAILED] Took 8.16 seconds =======

Could this be specific to the esp32-C3?

Fish

oh, it also says:


  • Looking for ESP8266WiFi.h dependency? Check our library registry!
  • CLI > platformio lib search “header:ESP8266WiFi.h”
  • Web > PlatformIO Registry

finally…I read this post but wasn’t sure what it meant:WiFImanager esp32-s2 and s3 - #4 by ambadatusername

…why is that library trying to access the ESP8266 WiFi library when you configured it for a ESP32 board? Can you please show your full platformio.ini and minimal code example?

Sure this is my .ini:

[[env:lolin_c3_mini]
platform = espressif32
board = lolin_c3_mini
framework = arduino
lib_deps =
fbiego/ESP32Time@^2.0.0
olikraus/U8g2@^2.34.13
lennarthennigs/Button2@^2.2.2
adafruit/RTClib@^2.1.1
tzapu/WiFiManager@^0.16.0
upload_protocol = esp-builtin
debug_tool = esp-builtin
monitor_speed = 115200

in my main.cpp:
#include <Arduino.h>
#include <ESP32Time.h>
#include “RTClib.h” //This is a local version of the Library with alarmIsEnabled();
#include <U8g2lib.h>
#include <Button2.h>
#include <WiFiManager.h>
#include “CustomFonts.h”
#include “Bitmaps.h”

I get the error simply when adding the #include
in WiFiManager.h are the lines
#ifndef WiFiManager_h
#define WiFiManager_h
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include

so the error is flagging those lines from WiFiManager.h header for the library

You can’t really use the PIO registry version here because it’s 3 years outdated. Replace that with a direct download link of

   https://github.com/tzapu/WiFiManager/archive/refs/heads/master.zip

Hey max…sorry for the silence, I had to run an errand. So I install the latest version of the library then?

o.k. That version worked! Max, you are the BEST! I owe you a beer.

So is there a way we can request PIO update to their registry?

Fish