PlatformIO Community

Wire.h not found, platformio latest version

Hi, I’m using platformio on Windows and I wanna try to compile an arduino sketch. The problem is that when I compile it, it says:

“C:\Users\MyUser\Desktop\Arduino\arduino-1.8.2\libraries\RTClib\RTClib.cpp:4:18: fatal error: Wire.h: No such file or directory
#include < Wire.h >
^
compilation terminated.”

Adding “#Include < Wire.h >” to the start of the file didn’t help and neither did removing .pioenvs. I’m using PlatformIO 3.4.0b11.

2 Likes

Try to add to platformio.ini into env section

lib_deps = Wire
10 Likes

thank for answer :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes:

Libraries were really frustrating a few months ago when i moved over from Arduino.
I usually have to reopen PlatformIO to get it to recognize a newly installed library.

I have been advised to not use all the extra library inclusion techniques. Now I put a copy of the new library PIO can’t find into the local /lib folder, in Projects.

I have also been advised to empty the /lib folder in users/xxx/PlatformIO/Lib/ .

In Arduino, I maintained a fat folder of global libraries. They tell you not to make anything global.
I still have a master folder full of libraries, but it isn’t connected to any scripts.

And it’s been working.

this solution works also to neironx/RTCLib dependence… thanks :slight_smile:

yes this is really a bad thing. Even I have to restart everytime after installing new libs. Everytime I run into some issue. The last issue was solved but see now I’m unable to add Liquid crystal lib even though I installed from lib manager and I also see it is there in platform.ini. Why is this happening? How can I avoid this nonsense of adding libraries to each project. Half of my time get consumed in this process. :frowning: Screenshot (3135)

Screenshot (3132) I can see the library in platform.ini but unable to use it

I’m getting the same “Wire.h not found” Error but for a different reason as my lib_deps already includes the Wire as below

image

In my case, the Compilation run fine until I start to include those libraries in the lib_deps:

esphome/AsyncTCP-esphome @ ^1.2.2

ottowinter/ESPAsyncWebServer-esphome @ ^2.1.0

ayushsharma82/AsyncElegantOTA @ ^2.2.6

They meant to perform the OTA for the ESP32 but once I include them, different " .h not found" Errors start to appear.

Once I remove the folder that contains the OTA.h & OTA.cpp (or comment them out), the compilation runs fine again.

What could be the error in this?

Does it get better when you add lib_ldf_mode = chain+ (docs) to the platformio.ini? Does it show Wire as a dependency for OTA in the dependency graph at the beginning of compilation?

1 Like

It works…it does show Wire as a dependency for OTA.

The graph tree also become much bigger than before.

I used only

lib_ldf_mode = chain+

without (docs) as I didn’t know what to replace docs with.

Thank you Maxgerhardt

1 Like

Hi,
I’m new to plaftormio and I’m facing similar issue.

I created new project. empty project compiles without issues.

I installed Firebase Arduino Client Library for ESP8266 and ESP32 library using library manager. I can see it was added to platform.ini and also I can see it in .pio/libdeps folder

platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_ldf_mode = chain+
lib_deps = mobizt/Firebase Arduino Client Library for ESP8266 and ESP32@^3.1.5

when I try to build project (without any changes to main.cpp) I get error:

.pio\libdeps\esp32doit-devkit-v1\Firebase Arduino Client Library for ESP8266 and ESP32\src\FirebaseFS.h:27:20: fatal error: SPIFFS.h: No such file or directory

if I add include to main.cpp

#include <FirebaseESP32.h>

I also get error:

src\main.cpp:3:27: fatal error: FirebaseESP32.h: No such file or directory

no idea what to do, I tried to google for any solutions, I tried to read tutorials on how to use libraries in platformio and everything indicates this should work, but for some reason it doesn’t.

also adding whole build log for details:

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (3.5.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (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.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Firebase Arduino Client Library for ESP8266 and ESP32> 3.1.5
|   |-- <WiFi> 1.0
|-- <WiFi> 1.0
Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\src\main.cpp.o
src\main.cpp:3:27: fatal error: FirebaseESP32.h: No such file or directory

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

compilation terminated.
Compiling .pio\build\esp32doit-devkit-v1\libe87\Firebase Arduino Client Library for ESP8266 and ESP32\Firebase.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\libe87\Firebase Arduino Client Library for ESP8266 and ESP32\bearssl\i31_bitlen.c.o
Compiling .pio\build\esp32doit-devkit-v1\libe87\Firebase Arduino Client Library for ESP8266 and ESP32\bearssl\i31_decmod.c.o
Compiling .pio\build\esp32doit-devkit-v1\libe87\Firebase Arduino Client Library for ESP8266 and ESP32\bearssl\i31_decode.c.o
Compiling .pio\build\esp32doit-devkit-v1\libe87\Firebase Arduino Client Library for ESP8266 and ESP32\bearssl\i31_decred.c.o
*** [.pio\build\esp32doit-devkit-v1\src\main.cpp.o] Error 1
In file included from .pio\libdeps\esp32doit-devkit-v1\Firebase Arduino Client Library for ESP8266 and ESP32\src\Firebase.h:32:0,
                 from .pio\libdeps\esp32doit-devkit-v1\Firebase Arduino Client Library for ESP8266 and ESP32\src\Firebase.cpp:31:
.pio\libdeps\esp32doit-devkit-v1\Firebase Arduino Client Library for ESP8266 and ESP32\src\FirebaseFS.h:27:20: fatal error: SPIFFS.h: No such file or directory

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

compilation terminated.
*** [.pio\build\esp32doit-devkit-v1\libe87\Firebase Arduino Client Library for ESP8266 and ESP32\Firebase.cpp.o] Error 1
================================== [FAILED] Took 4.24 seconds ==================================
The terminal process "C:\Users\olive\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'esp32doit-devkit-v1'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Not reproducable. Using your platformio.iin and ListFilles.ino as src/main.cpp with added #include <Arduino.h> as the first line compiles.

Dependency Graph
Dependency Graph
|-- <Firebase Arduino Client Library for ESP8266 and ESP32> 3.1.5
|   |-- <SPIFFS> 1.0
|   |   |-- <FS> 1.0
|   |-- <FS> 1.0
|   |-- <SD_MMC> 1.0
|   |   |-- <FS> 1.0
|   |-- <SD(esp32)> 1.0.5
|   |   |-- <FS> 1.0
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|   |-- <WiFi> 1.0
|   |-- <WiFiClientSecure> 1.0
|   |   |-- <WiFi> 1.0
|   |-- <Update> 1.0
|-- <WiFi> 1.0
|-- <SPIFFS> 1.0
|   |-- <FS> 1.0
|-- <FS> 1.0
|-- <SD_MMC> 1.0
|   |-- <FS> 1.0
|-- <SD(esp32)> 1.0.5
|   |-- <FS> 1.0
|   |-- <SPI> 1.0
|-- <SPI> 1.0
|-- <WiFiClientSecure> 1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
[...]
RAM:   [=         ]  12.6% (used 41252 bytes from 327680 bytes)
Flash: [========  ]  79.7% (used 1044750 bytes from 1310720 bytes)
Building .pio\build\esp32doit-devkit-v1\firmware.bin
esptool.py v3.1
Merged 1 ELF section
============================================= [SUCCESS] Took 24.22 seconds =============================================

Please open a new topic about this.

Each pio framework has it’s own Wire.h if it is relevant. For example:

./packages/framework-arduino-samd-adafruit/libraries/Wire/Wire.h
./packages/framework-arduino-mbed/libraries/Wire/Wire.h
./packages/framework-arduinoespressif8266/libraries/Wire/Wire.h
./packages/framework-arduinoespressif32/libraries/Wire/src/Wire.h
./packages/framework-arduino-avr/libraries/Wire/src/Wire.h

Since pio knows your framework selection and knows that frameworks have libraries, it should be automatic. You should not need to fiddle with the included dependencies. IMO