Hi,
I’m quite new to PlatformIO and have generally found it quite easy to transition from the Arduino IDE, I migrated using the tool which leaves most of my libraries in their old Arduino IDE location. However, I’m having a problem with dependencies with the Adafruit_MCP23017 library, a new library I’ve just introduced to my project which I’ve added as PIO library.
The C pre-processor code (excerpt below) from Adafruit_MCP23017.h looks OK to me and I would expect it to just identify the Wire.h library as a dependency as I’m compiling for ESP32, so ARDUINO_AVR_GEMMA should not be defined.
#ifndef ARDUINO_AVR_GEMMA
//TinyWireM is now part of
// Adafruit version of Wire Library, so this
// will work with Adafruit ATtiny85's
//But Arduino Gemma doesn't use that library
// We do NOT want to include Wire if it's an arduino Gemma
#include <Wire.h>
#else
#include <TinyWireM.h>
#define Wire TinyWireM
#endif
In fact it identifies both Wire.h and TinyWireM.h as dependencies and then goes on to fail as it can’t find the avr/interrupt.h library, which I wouldn’t expect it to.
Preprocessor macros are only evaluated by the library dependency finder (LDF) for chain+ and deep+, see documentation and documentation. So I would try adding
Hi Max,
thanks for the quick response, I tried both chain+ and deep+ and they did make a difference, they got rid of the TinyWireM library. Only problem was they also got rid of quite a few libraries I do need as well! I read the documentation thanks, but doesn’t really explain what I’m seeing, maybe because I’m passing the file that sets a lot of the defines itself as a directive from platformio.ini, so probably LDF isn’t aware of those defined directives:
build_flags = -D BUILD=“zOffice.h”
Though one of the missing libraries is WebServer.h from the “#elif defined ( ESP32 )” section, nothing to do with my build file. I did try “lib_compat_mode = strict” but that just seemed to make thiungs worse.
My library dependancies in main are quite complicated and cater for both ESP8266 and ESP32 and a range of sensors which can be present or absent. The include statement in my main .cpp file look like this:
When you upgrade to the new version the name is another ----> Adafruit_MCP23X17.h
sou when sketch trying found file Adafruit_MCP23017.h cannot found it .
You must change Adafruit_MCP23017.h to Adafruit_MCP23X17.h in a all sketch
de Jerzy Smietanski SP9AUV