PlatformIO Community

Missing (perhaps) library

Hi

I have just instaled Platformio with VScode on a different computer, set up my Git repos etc. Whilst fetching the liquid crystal library (which I also have installed successfully on my dev machine - same project), I tried to compile the code and got a missing wire library error. I checked in liquidcrystal.h and there doesn’t seems to be any reference to <Wire.h> I obviously haven’t looked hard enough.

I tried to find Wire in the PIO library manager and it said there were 300 odd references, I looked through the first 20- 30 in the list but gave up.

The line number 54 mentoned in the compiler output is #define EXEC_TIME 37

which doesn’t have much to do with wire.h as far as my limited knowledge allows.

Any help much appreciated

here’s the compile error:

`-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR (3.4.0) > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr 5.1.0
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <LiquidCrystal> 1.5.0
Building in release mode
Compiling .pio\build\megaatmega2560\src\Two_Way_Radio_Master.cpp.o
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\FastIO.cpp.o
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\LCD.cpp.o
.pio\libdeps\megaatmega2560\LiquidCrystal\I2CIO.cpp:54:13: fatal error: Wire.h: No such file or directory

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

    #include <Wire.h>
             ^~~~~~~~
compilation terminated.
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o] Error 1
================================================================================================== [FAILED] Took 3.30 seconds ==================================================================================================
The terminal process "C:\Users\Paul\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

``

The I2CIO.cpp file has a refrence to the I2C library.

You must add a reference to the library in your main code in order for PlatformIO to pick up the libraries correctly. Just adding the library but not adding any code reference to it will break the build. This is known quirk and has been e.g. discussed as early as 2016 in Wire.h is missing and cause a simple program to not compile.

The alternative is to add Wire to the lib_deps expression of the platformio.ini.