PlatformIO Community

Compilation Terminated for “SerialTransfer” for #include “Wire.h”

I have been attempting to compile an example of SerialTranfer code from RS485 serial communication, passing multiple values - #2 by gcjr - Programming Questions - Arduino Forum included below. I have tried to compile both the RX and TX code twice and get library errors starting with Wire.h. The compile attempt (printout included below) is clean with only the SerialTransfer library installed that I am very interested in trying.
/* Comments and source code from Example TX Arduino Sketch:
RS485 serial communication, passing multiple values - #3 by Power_Broker - Programming Questions - Arduino Forum
The author Power_Broker said (May '2020): “You can use SerialTransfer.h to automatically packetize and parse your data for inter-Arduino communication without the headache.” Here are the library’s features: works with “software-serial” libraries, is non blocking, uses packet delimiters, uses consistent overhead byte stuffing, uses CRC-8 (Polynomial 0x9B with lookup table), allows the use of dynamically sized packets (packets can have payload lengths anywhere from 1 to 254 bytes), can transfer bytes, ints, floats, and even structs!!.
Included below is the Example TX Arduino Sketch:

#include <Arduino.h>
#include "SerialTransfer.h"
SerialTransfer myTransfer;

void setup()

void loop()
  char buff[] = "hi";

  myTransfer.txObj(buff, sizeof(buff));

During the several attempts to compile the SerialTransfer code examples with PlatformIO I get “include” errors, (some of which I can correct), but I cannot resolve the “Wire.h” error (which I am listing below). I am using PlatformIO (Core 5.1.1·Home 3.3.4) and of Visual Studio Code (July 2021 (version 1.59)). I have used the Library Manager to install the SerialTransfer library before this compile attempt.
Earlier I tried to compile both of these RX and TX programs two times before this. I feel the one thing that complicates my attempts is that two or three different Wire.h (different text) on my hard drive. Some are 23KB, some are 3KB, and some are 6KB.
Here are a few Wire.h listings and sizes. *************
C:\Users\keith\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\Wire\Wire.h 3KB (Starts with TwoWire.h)
C:\Users\keith\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\Wire\src\Wire.h 3KB (Starts with TwoWire.h)
C:\Users\keith.platformio\packages\framework-arduino-avr-mightycore\libraries\Wire\src\Wire.h 6KB (TwoWire) cp2006
KFK This is an “Error Listing” of parts of this last compile attempt: *********************** START OF ERROR MESSAGE

DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
 - framework-arduino-avr 5.1.0
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SerialTransfer> 3.1.2
Building in release mode
Compiling .pio\build\megaatmega2560\src\main.cpp.o
Compiling .pio\build\megaatmega2560\libd9e\SerialTransfer\I2CTransfer.cpp.o
Compiling .pio\build\megaatmega2560\libd9e\SerialTransfer\Packet.cpp.o
Compiling .pio\build\megaatmega2560\libd9e\SerialTransfer\SPITransfer.cpp.o
In file included from .pio\libdeps\megaatmega2560\SerialTransfer\src\I2CTransfer.cpp:1:0:
.pio\libdeps\megaatmega2560\SerialTransfer\src\I2CTransfer.h:4:10: 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  >
 #include "Wire.h"
compilation terminated.
*** [.pio\build\megaatmega2560\libd9e\SerialTransfer\I2CTransfer.cpp.o] Error 1
====================================== [FAILED] Took 1.67 seconds ======================================
The terminal process "C:\Users\keith\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
************  END OF ERROR MESSAGE  ****************

KFK Surely the resolution of this error may be simple. Please help me if you understand the answer to my situation. KFK

Due to the way PlatformIO’s Library Dependency Finder works, you either need to add a #include <Wire.h> in in your main sketch, or bump lib_ldf_mode up to lib_ldf_mode = chain+.

Thank You: I hope to get the opportunity to make these changes tomorrow. These have been some interesting days lately. KFK

Thank You: The #include <Wire.h> worked perfectly. I realize now that a hard part is still ahead - just understanding how the PC to Arduino communications must work. KFK