I have just started using PlatformIO and my sketches were working until recently, I’m not sure what I changed but there now seems to be a issue with my dependency being incomplete.
This is what I mean, in this header “HornerGPS.h” I include both “HornetMODULE.h” and “HornetLOGGER.h”.
#ifndef HORNET_GPS_H
#define HORNET_GPS_H
#include <Arduino.h>
#include <HornetMODULE.h>
#include <HornetLOGGER.h>
#include <TinyGPSPlus.h>
class HornetGPS : public HornetModule
{
public:
HornetGPS(HornetLOGGER *logger);
void begin();
void print_gps();
private:
bool system_time_set = false;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus *gps;
void read(unsigned long t);
float latitude, longitude;
float speed;
time_t time;
};
#endif // HORNET_GPS_H
This is the same way I include them in all of the other header files which have no problem including both headers.
However as you can see from the below dependency graph HornetGPS does not include either header but it does include “TinyGPSPlus.h”.
Dependency Graph
|-- Adafruit BMP3XX Library @ 2.1.2
| |-- Adafruit BusIO @ 1.13.2
| | |-- Wire @ 1.0
| | |-- SPI @ 1.0
| |-- Wire @ 1.0
| |-- SPI @ 1.0
|-- StateMachine @ 1.0.11
|-- TinyGPSPlus @ 1.0.3
|-- HornetFC
| |-- HornetBARO
| | |-- Adafruit BMP3XX Library @ 2.1.2
| | | |-- Adafruit BusIO @ 1.13.2
| | | | |-- Wire @ 1.0
| | | | |-- SPI @ 1.0
| | | |-- Wire @ 1.0
| | | |-- SPI @ 1.0
| | |-- Adafruit Unified Sensor @ 1.1.6
| | |-- HornetMODULE
| | | |-- HornetLOGGER
| | | | |-- DS1307RTC
| | | | | |-- Time @ 1.6.1
| | | | | |-- Wire @ 1.0
| | | | |-- EEPROM @ 2.0
| | | | |-- HornetGPS
| | | | | |-- TinyGPSPlus @ 1.0.3
| | | | |-- SD @ 2.0.0
| | | | | |-- SdFat @ 2.1.2
| | | | | | |-- SPI @ 1.0
| | | | |-- SPI @ 1.0
| | | | |-- Time @ 1.6.1
| | | | |-- Wire @ 1.0
| |-- HornetBUZZER
| | |-- HornetMODULE
| | | |-- HornetLOGGER
| | | | |-- DS1307RTC
| | | | | |-- Time @ 1.6.1
| | | | | |-- Wire @ 1.0
| | | | |-- EEPROM @ 2.0
| | | | |-- HornetGPS
| | | | | |-- TinyGPSPlus @ 1.0.3
| | | | |-- SD @ 2.0.0
| | | | | |-- SdFat @ 2.1.2
| | | | | | |-- SPI @ 1.0
| | | | |-- SPI @ 1.0
| | | | |-- Time @ 1.6.1
| | | | |-- Wire @ 1.0
| |-- HornetGPS
| | |-- TinyGPSPlus @ 1.0.3
| |-- HornetIMU
| | |-- HornetMODULE
| | | |-- HornetLOGGER
| | | | |-- DS1307RTC
| | | | | |-- Time @ 1.6.1
| | | | | |-- Wire @ 1.0
| | | | |-- EEPROM @ 2.0
| | | | |-- HornetGPS
| | | | | |-- TinyGPSPlus @ 1.0.3
| | | | |-- SD @ 2.0.0
| | | | | |-- SdFat @ 2.1.2
| | | | | | |-- SPI @ 1.0
| | | | |-- SPI @ 1.0
| | | | |-- Time @ 1.6.1
| | | | |-- Wire @ 1.0
| | |-- Wire @ 1.0
| |-- HornetLOGGER
| | |-- DS1307RTC
| | | |-- Time @ 1.6.1
| | | |-- Wire @ 1.0
| | |-- EEPROM @ 2.0
| | |-- HornetGPS
| | | |-- TinyGPSPlus @ 1.0.3
| | |-- SD @ 2.0.0
| | | |-- SdFat @ 2.1.2
| | | | |-- SPI @ 1.0
| | |-- SPI @ 1.0
| | |-- Time @ 1.6.1
| | |-- Wire @ 1.0
| |-- HornetSBUS
| | |-- HornetMODULE
| | | |-- HornetLOGGER
| | | | |-- DS1307RTC
| | | | | |-- Time @ 1.6.1
| | | | | |-- Wire @ 1.0
| | | | |-- EEPROM @ 2.0
| | | | |-- HornetGPS
| | | | | |-- TinyGPSPlus @ 1.0.3
| | | | |-- SD @ 2.0.0
| | | | | |-- SdFat @ 2.1.2
| | | | | | |-- SPI @ 1.0
| | | | |-- SPI @ 1.0
| | | | |-- Time @ 1.6.1
| | | | |-- Wire @ 1.0
| |-- SPI @ 1.0
| |-- StateMachine @ 1.0.11
| |-- Wire @ 1.0
So the error I get makes some sense.
In file included from lib\HornetMODULE/HornetMODULE.h:4:0,
from lib\HornetGPS\HornetGPS.h:4,
from lib\HornetGPS\HornetGPS.cpp:2:
lib\HornetLOGGER/HornetLOGGER.h:11:16: fatal error: SD.h: No such file or directory
************************************************************
* Looking for SD.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:SD.h"
* Web > Compiling .pio\build\teensy41\lib247\SdFat\FatLib\FatPartition.cpp.o
https://registry.platformio.org/search?q=header:SD.h
*
************************************************************
compilation terminated.
I have tested the example SD sketch in PlatformIO and it works fine, so why It causing problems in this situation?