ESP8266WiFi library not found

I am trying to use the ESP8266WiFi library, but it is not found. Meanwhile I believe trough further reading that it might be included in PlatformIO. However when I try to compile my sample project I get an error:

Compiling .pioenvs/esp12e/liba7d/WifiManager_ID567/WiFiManager.cpp.o
In file included from .piolibdeps/WifiManager_ID567/WiFiManager.cpp:13:0:
.piolibdeps/WifiManager_ID567/WiFiManager.h:16:25: fatal error: ESP8266WiFi.h: No such file or directory

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

#include <ESP8266WiFi.h>
compilation terminated.
Compiling .pioenvs/esp12e/FrameworkArduino/Esp-version.cpp.o
Compiling .pioenvs/esp12e/FrameworkArduino/Esp.cpp.o
*** [.pioenvs/esp12e/liba7d/WifiManager_ID567/WiFiManager.cpp.o] Error 1
====================================================================== [ERROR] Took 4.33 seconds ======================================================================
The terminal process terminated with exit code: 1

MY platform.ini file is here:

platform = espressif8266
board = ESP12e
framework = arduino

monitor_speed = 9600

lib_deps =

What am I doing wrong here? Does anyone know?

ESP8266WiFi is a core library provided with the ESP8266 Arduino board support core.

How are you including it? Or is it being automatically included by the wifi manager? Can you share the rest of your code, or the minimum code necessary to reproduce the issue? I suspect it is something else triggering it, and ESP8266WiFi is being blamed. i.e. The board value is wrong… it should be lower case esp12e as it’s case sensitive (on linux, anyway).

I have

#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //

For a board specified in platformio.ini as (567 is the id for WifiManager)

[env:nodemcuv2 - serial]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = 
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
monitor_speed = 115200

Thank you for your reply.
I reinstalled everything because it wouldn’t start compiling anymore.

Then, every time I received an error about a missing .h file, I included it in my main.cpp.

Now a got the same #include-header as you have and it does compile.

But I wonder if that is the way it should be with the lib_deps entry???

Thank you for helping me out.

FYI, this is my code (not usage of any library):

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h>

void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:

The lib_deps entry tells platformio what external library dependencies it needs to download… not the libraries that are included with a platform/core, or private ones in your project.

In your case, you want the WifiManager external library (dependency), so you specify that via the lib_deps line, and it will go and fetch that if it doesn’t already exist. And will keep it up to date if you run the ‘update libraries’ command (or is it libraries update?) on the project.

Glad you got it working, have fun! :slight_smile: