I have a project which uses the liquid crystal library and it throws the error below. I have tried searching the pio library service for ‘wire.h’ or just ‘wire’ and it comes back with 585 offerings. Is there a better way to do this please?
**************************************************************
#include <Wire.h>
^~~~~~~~
compilation terminated.
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o] Error 1
====================================================================================== [FAILED] Took 3.14 seconds ======================================================================================
The termin
It compiles just fine. I do get errors if I forget to add in the #include <Arduino.h> – have you got that in your source?
Does your setup compile the above code or does it still error out? If there are still errors, can you post the output from the compiler please. Thanks.
Also, what’s in your platformio.ini? Mine is the default one created for a new project:
PlatformIO has a quirk where if you don’t include a library in the main source file, it’s sub-dependencies are not found correctly. Please place a #include <LiquidCrystal_I2C.h> in your src/main.cpp (or similiar).
“Wire” is the I2C base library in the Arduino core, you should not install one from the PlatformIO registry for it. Remove the .pio folder and remove any reference to an external Wire library pulled from the registry from the platformio.ini. If anything, you can reference its usage by adding just Wire to the lib_deps, PlatformIO will find it in the libraries/ folder of the Arduino core then.
ok, many thanks for replies. I have a dev machine and an operations machine. The project is version controlled on github. The code in question compiles fine on my dev machine, but the error occurs on the operations machine.
On the operations machine, I just cloned the github repo. Any changes to code happen on the dev machine only and I pull the commits on the operations machine from the git remote. The only reason for having the source code on the operations machine is in case I wanted to amke a change in the field on the fly as it were, and this is what happened on the occasion when compile failed. I made a small change to code on the operations machine and to my surprise the ‘wire’ error came up.
So, when managing the repo, do I need to include files other than this lot shown below?
The change to code on the ops m/c was to a constant in the code which defines number of steps for a stepper motor. The code hasn’t been compiled on the machine previously, only on the dev machine. However, the code is supposedly identical (as per github remote).
The ops machine is on a remote site now, so I won’t be able to check if C:\Users\<user>\.platformio\packages\framework-arduino-avr\libraries\Wire\src\Wire.h present until Weds. I’ll reply again then.
I’m guessing it won’t be as looking at my github repo image in the previous post, C:\Users<user>.platformio\packages\ is not part of the repo. But also I’m thinking I wouldn’t want it to be? I just need to version control my own code and PIO pulls in stuff as necessary?
OK , so I guess I should mention in case its relevant that on the ops machine VScode is installed on a removable USB3 diskdrive which Windows allocates as Drive D: on my machine.
I looked for C:\Users\<user>\.platformio\packages\framework-arduino-avr\libraries\Wire\src\Wire.h and it does exist. However, should I be looking for it on D:…etc If so, it’s not there, just D:\Users\Paul\MicrosoftVS Code. I’ve probably installed PIO / VSCode incorrectly. Perhaps I need to specify a path or reinstall properly?
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
upload_port = COM8
monitor_port = COM8
lib_deps = fmalpartida/LiquidCrystal@^1.5.0
[platformio]
description = The Radio Master
having removed the .pio folder, the core has reinstalled. When comoiling I now get this:
Executing task: C:\Users\Paul\.platformio\penv\Scripts\platformio.exe run <
Processing megaatmega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-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
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\FastIO.cpp.o
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\LCD.cpp.o
*** [.pio\build\megaatmega2560\src\Two_Way_Radio_Master.cpp.o] Error 1
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\FastIO.cpp.o] Error 1
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o] Error 1
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\LCD.cpp.o] Error 1
====================================================================================== [FAILED] Took 2.77 seconds ==
The compiler got damaged or antivirus is acting up. Try removing C:\Users\Paul\.platformio\toolchain-avr and rebuilding. If in doubt, remove the entire C:\Users\Paul\.platformio\ folder and rebuild the project.
interesting, C:\Users\Paul\.platformio\toolchain-avr did not exist, so I deleted C:\Users\Paul\.platformio\
still get this:
Executing task: C:\Users\Paul\.platformio\penv\Scripts\platformio.exe run <
Processing megaatmega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-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
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\FastIO.cpp.o
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\LCD.cpp.o
*** [.pio\build\megaatmega2560\src\Two_Way_Radio_Master.cpp.o] Error 1
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\FastIO.cpp.o] Error 1
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o] Error 1
'avr-g++' is not recognized as an internal or external command,
operable program or batch file.
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\LCD.cpp.o] Error 1
====================================================================================== [FAILED] Took 2.82 seconds ===
Sorry I meant C:\Users\Paul\.platformio\packages\toolchain-avr there.
Hmm this shouldn’t be happening if the PlatformIO core + packages was successfully reinstalled. Does the above mentioned folder exist now, along with bin/avr-g++.exe in it?