Arduino IDE can't find ESP8266WiFi.h file
Asked Answered
U

4

30

I am trying to use NOD MCU ESP8266WiFi with Arduino IDE

When I run this code:

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "YourAuthToken";
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup(){
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}
void loop()
{
  Blynk.run();
}

I get the following error:

fatal error: ESP8266WiFi.h: No such file or directory

     #include <ESP8266WiFi.h>    
                         ^
compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.
Underlying answered 28/4, 2018 at 19:24 Comment(2)
for me, it was as simple as remembering to select the right board: Tools > Board > Generic ESP8266 ModuleDichromic
Thanks, Ryan! That's a real time saver! In my case, I had switched to ESP32 for a different project, and didn't realize I had to switch board back (to 8266) when I resumed work on my original project. I was about to go looking for what had happened to the Wifi libraries... would have wasted a lot of time :)Sept
Y
52

When programming the NODEMCU card with the Arduino IDE, you need to customize it and you must have selected the correct card.

Open Arduino IDE and go to files and click on the preference in the Arduino IDE.

Add the following link to the Additional Manager URLS section: "http://arduino.esp8266.com/stable/package_esp8266com_index.json" and press the OK button.

Then click Tools> Board Manager. Type "ESP8266" in the text box to search and install the ESP8266 software for Arduino IDE.

You will be successful when you try to program again by selecting the NodeMCU card after these operations. I hope I could help.

Ye answered 28/4, 2018 at 22:58 Comment(3)
Works like charm.Chung
To be clear on gokhan's last point: if you have a different board selected (like an ESP32, in my case), under Tools->Board, then the compiler will not find the ESP8266WiFi.h header file. Arduino IDE 1.8.13Marquise
I have NodeMCU-32S board, and in Arduino IDE I have NodeMCU-32S board selected, and there is no ESP8266WiFi.h.Evolution
S
30

Starting with 1.6.4, Arduino IDE can be used to program and upload the NodeMCU board by installing the ESP8266 third-party platform package (refer https://github.com/esp8266/Arduino):

  • Start Arduino, go to File > Preferences
  • Add the following link to the Additional Boards Manager URLs: http://arduino.esp8266.com/stable/package_esp8266com_index.json and press OK button
  • Click Tools > Boards menu > Boards Manager, search for ESP8266 and install ESP8266 platform from ESP8266 community (and don't forget to select your ESP8266 boards from Tools > Boards menu after installation)

To install additional ESP8266WiFi library:

  • Click Sketch > Include Library > Manage Libraries, search for ESP8266WiFi and then install with the latest version.

After above steps, you should compile the sketch normally.

EDIT: the lib might have already been included in the later version of Arduino IDE, so firstly, check if it is included, then if not yet, install it, you can refer below link for a systematic guidance on how to debug such kind of issue: https://www.programmingelectronics.com/no-such-file-error/

Stoneham answered 20/6, 2018 at 15:1 Comment(6)
I did this, then had to do as intructed here: arduino-esp8266.readthedocs.io/en/latest/faq/…Macrae
ESP8266WiFi doesn't seem to be in the Library Manager listing anymore.Hydromechanics
@Jaxian: which version of Arduino IDE was used?Stoneham
I couldn't find this lib in the manager either. The code compiled nevertheless (on a freshly set up computer), so I assume that it is included in the Arduino IDE installation (or the board configs?) now. I'm using Arduino IDE 1.8.15.Anisaanise
@Fred: I the link I gave said: "An easy way to check to see if you have that file is to be in the Arduino IDE and go to Sketch > Include Library, and then look for the name of that library." - you can check if the lib was included?Stoneham
@StevenLee: Clicking on "ESP8266WiFi" in the include library menu adds 18 includes which all seem to be related to esp wifi. #6 is <ESP8266WiFi.h> which I had used in my original code. So yes, it seems to be included in the IDE installation.Anisaanise
P
6

Just don't forget to select your board, after install

Promote answered 27/7, 2021 at 16:25 Comment(0)
S
4

For those who are having trouble with fatal error: ESP8266WiFi.h: No such file or directory, you can install the package manually.

  1. Download the Arduino ESP8266 core from here https://github.com/esp8266/Arduino
  2. Go into library from the downloaded core and grab ESP8266WiFi.
  3. Drag that into your local Arduino/library folder. This can be found by going into preferences and looking at your Sketchbook location

You may still need to have the http://arduino.esp8266.com/stable/package_esp8266com_index.json package installed beforehand, however.

Edit: That wasn't the full issue, you need to make sure you have the correct ESP8266 Board selected before compiling.

Hope this helps others.

Stesha answered 22/11, 2020 at 0:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.