ESP8266-12E with arduino framework : build error ESP8266WiFi.h


I’me having trouble building a very minimalistic project for my new esp8266, the error I get at build is :

In file included from .pioenvs/esp12e/FrameworkArduino/Arduino.h:246:0,from .pioenvs/esp12e/FrameworkArduino/FS.h:25,from .pioenvs/esp12e/FrameworkArduino/FS.cpp:21:.pioenvs/esp12e/FrameworkArduino/HardwareSerial.h:2:25: fatal error: ESP8266WiFi.h: No such file or directory#include <ESP8266WiFi.h>^compilation terminated.scons: *** [.pioenvs/esp12e/FrameworkArduino/FS.o] Error 1

my main.cpp file is :

#include <Arduino.h>

void setup () {

void loop () {

and my platform.ini is :

platform = espressif
framework = arduino
board = esp12e

pio lib list :

[ ID  ] Name             Compatibility         "Authors": Description
[ 429 ] aREST            arduino, atmelavr, atmelsam, espressif, teensy "marcoschwartz": RESTful API for Arduino using HTTP or S
erial communications

I can build a normal arduino project, all is fine. Am I missing something ?

Try to add to your main.cpp this

#include <ESP8266WiFi.h>

Hi !

First : thank you for that wonderful piece of software :wink:

doesn’t work either. The strange thing is that the file exists and is in project/.pioenvs/esp12e/ESP8266WiFi/ESP8266WiFi.h

Try to remove .pioenvs directory manually from the project

I’ve deleted this directory. It’s recreated when I build, but still the same error.

I’ve no clue where to look to resolve this. I’ve reinstalled the arduino ide (yes, i’m that desperate :wink: ), imported the “arduino esp8266” toolchain (“board manager”) and it built and uplaoded fine :-/

Please sorry for the inconvenience. I don’t understand your problem. I’ve just tested your simple main.cpp sketch and it builds without any problems.

Try to remove ~/.platformio folder and start a build process.

P.S: Do you use PlatformIO IDE or CLI?

i’m using platformio ide. I deleted the .platformio directory, rebuilt my project, some packages were downloaded (tool-scons and others…) and …

wow, that worked !

thanks :wink:

1 Like

That is good for you but is not good for me :cry: I wanted to understand this problem. Did you modify /.platformio/packages ?


no, not by hand, but I removed/installed a lot of packages recently (using “dnf remove xxx” from my distro fedora 23), and I noticed that some dependancies could be broken (“avrdude” “gcc-avr” “scons” (and maybe others) were gone during this uninstall/reinstall process…).

I manually reinstalled these 3 (dnf install xxx), but I noticed that, after removing “.platformio”, the ide reinstalled a package named “tool-scons”, maybe it’s related to this issue…

I think the problem was more with my system than with platformio.

The problem was with that you deleted PlatformIO packages manually. The info about them is located in appstate.json file. It means, that for PlatformIO DB the packages are installed :slight_smile: But… In real life you deleted them :smile:

P.S: I have good news. PlatformIO 3.0 is rewritten from the scratch and has new development platform and package managers. You can manage packages manually.

I apologize for resurrecting such old post, but since it’s a related issue, it’s more suitable than opening a new thread.

I’m running with a problem similar to StupidDuck. I’m using CLI dev edition and today it update do 3.0.0b9, then all hell broke loose.

This is an Arduino project and I have a tree structure listed below:
| |–Core
| | | core.cpp
| | | core.h
| |–Flash
| | | flash.cpp
| | | flash.h
| |–Global
| | | global.cpp
| | | global.h
| |–Progmem
| | | progmem.h
| |–Rtc
| | | rtc.cpp
| | | rtc.h
| |–simee.ino

Simee.ino calls a function that is listed inside core.cpp and its header is as:
#include <Arduino.h>
#include <core.h>
#include <flash.h>
#include <rtc.h>
#include <global.h>
#include <progmem.h>

No matter which order I put the headers below <core.h> it always return me a
lib\Core\core.cpp:3:19: fatal error: flash.h: No such file or directory
include <flash.h>
compilation terminated.
scons: *** [.pioenvs\megaatmega2560\lib\Core\core.o] Error 1

I tried deleting .pioenvs and nothing.
I tried deleting atmelavr and nothing.
Reinstalled everything and nothing.

I’m a bit lost with this because I found a lot of threads listing the same error but it was all related to specific libraries.

Any help will be much appreciated!

Thanks in advance!

P.S.: Sorry for the long post.

Try running with pio run -v. Do you see some Library Dependency Finder warnings?

Hi Ivan!
Thanks for the prompt response!

I ran pio run -v and got this response:
avr-g++ -o .pioenvs\megaatmega2560\src\simee.ino.o -c -fno-exceptions -fno-threadsafe-statics -std=gnu++11 -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega2560 -DF_CPU=16000000L -DPLATF
ORMIO=030000 -DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA2560 -DARDUINO=10608 -IC:\users\breno.platformio\packages\framework-arduinoavr\cores\arduino -IC:\users\breno.platformio\packages\framework-arduin
oavr\variants\mega -Ilib\Core -Isrc src\simee.ino.cpp
avr-ar rcs .pioenvs\megaatmega2560\libFrameworkArduino.a .pioenvs\megaatmega2560\FrameworkArduino\CDC.o .pioenvs\megaatmega2560\FrameworkArduino\HardwareSerial.o .pioenvs\megaatmega2560\FrameworkArd
uino\HardwareSerial0.o .pioenvs\megaatmega2560\FrameworkArduino\HardwareSerial1.o .pioenvs\megaatmega2560\FrameworkArduino\HardwareSerial2.o .pioenvs\megaatmega2560\FrameworkArduino\HardwareSerial3.
o .pioenvs\megaatmega2560\FrameworkArduino\IPAddress.o .pioenvs\megaatmega2560\FrameworkArduino\PluggableUSB.o .pioenvs\megaatmega2560\FrameworkArduino\Print.o .pioenvs\megaatmega2560\FrameworkArdui
no\Stream.o .pioenvs\megaatmega2560\FrameworkArduino\Tone.o .pioenvs\megaatmega2560\FrameworkArduino\USBCore.o .pioenvs\megaatmega2560\FrameworkArduino\WInterrupts.o .pioenvs\megaatmega2560\Framewor
kArduino\WMath.o .pioenvs\megaatmega2560\FrameworkArduino\WString.o .pioenvs\megaatmega2560\FrameworkArduino_wiring_pulse.o .pioenvs\megaatmega2560\FrameworkArduino\abi.o .pioenvs\megaatmega2560\Fr
ameworkArduino\hooks.o .pioenvs\megaatmega2560\FrameworkArduino\main.o .pioenvs\megaatmega2560\FrameworkArduino\new.o .pioenvs\megaatmega2560\FrameworkArduino\wiring.o .pioenvs\megaatmega2560\Framew
orkArduino\wiring_analog.o .pioenvs\megaatmega2560\FrameworkArduino\wiring_digital.o .pioenvs\megaatmega2560\FrameworkArduino\wiring_pulse.o .pioenvs\megaatmega2560\FrameworkArduino\wiring_shift.o
avr-g++ -o .pioenvs\megaatmega2560\lib\Core\core.o -c -fno-exceptions -fno-threadsafe-statics -std=gnu++11 -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega2560 -DF_CPU=16000000L -DPLATF
ORMIO=030000 -DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA2560 -DARDUINO=10608 -IC:\users\breno.platformio\packages\framework-arduinoavr\cores\arduino -IC:\users\breno.platformio\packages\framework-arduin
oavr\variants\mega -Ilib\Core lib\Core\core.cpp

nothing much out of ordinary.

Where is the header with LIbrary Dependency Graph?

When I compile, I got this:

Library Dependency Graph |-- <Core>

The core.cpp file has this header
#include <Arduino.h>
#include <core.h>
#include <progmem.h>
#include <flash.h>
#include <rtc.h>
#include <global.h>

Please read Library Dependency Finder (LDF) — PlatformIO latest documentation

You need to change LDF mode or move dpeendent headers to core.h (instead core.cpp). Or mentin these headers in the project sources.

Hello again Ivan,

Thanks again for your time, helping me out on this.
Indeed, it was a dependency problem.

What startles me is that in the previous version, I don’t know, it looked like the compiler had a lazy approach on this header declaration.

After the update, it kinda became super tight.

As soon as a I moved my headers it worked back again!

Again, thank you so much!


You are right. The LDF mode was set to 2 in the previous beta builds. However, this mode causes a lot of problems with Arduino 1.0 libraries. We decided to keep mode=1 by defualt to avoid a lot of issues.

Developers have a choice. Also, library developers can enable LDF=2 in manifest. See Redirecting...

Oh ok!
It all makes sense now!

I gotta read the docs a bit more!:grinning:

I think I’m having a similar problem. I’ve been trying (in vain) to get TravisCI working with a non-library project in PlatformIO 3.x.

Here’s an example build failure. It appears that there’s a case-sensitivity issue with the (old) version of framework-arduinoespressif8266 (ESP8266Wifi.h vs ESP8266WiFi.h).

I tried to manually pull the toolchain from GitHub in subsequent builds, but it would get overwritten during platformio ci.

The first build, using platformio run instead, suffered from the same problem, so this led me down the path of messing with platformio ci (which I don’t think I actually need, since this is not a library).

Can anyone point me in the right direction?