PlatformIO Community

Arduino Library Dependencies Don't get Automatically Included

We are trying to transfer arduino ide code for teensy 4.0 into platformio

There is an EEPROM library natively in arduino/teensy, but this needed adding to platformio.ini file. After some searching we believe it is the d00616/arduino-NVM@^0.9.1 library that looks compatible and we added it to the .ini file.

However this library doesn’t compile either and requires"nrf.h" and we don’t know why this:
a.) isn’t automatically downloaded as a dependency
b.) what it does
c.) how to find a compatible version

Any help would be greatly appreciated

Well then it’s for a Nordic nRF chip and not for Teensy (NXP) chip at all. This library was actually discussed in the context of nRF chips in this forum already.

Do you see it in <home folder>/.platformio/packages/framework-arduinoteensy/libraries/EEPROM? What files are in there?

Thank you!

There is an EEPROM.h file in the folder you posted.

We have now realised that including the library directly in the main cpp code will successfully compile using that library (after we uninstalled the erroneous arduino-NVM library above)

However if the library was called from a header file as we were doing previously the compiler still throws the error “fatal error: EEPROM.h: No such file or directory”. If we include the library call in both cpp and header file then there are also no compilation errors.

The header file is in the same folder as the cpp file, we don’t know why it makes a difference where the library is called

The line to include the library is “#include <EEPROM.h>” in both cases.

Thank you for narrowing down the problem,
G

Please report this problem to Issues · platformio/platform-teensy · GitHub, there might be an issue with how built-in libraries are added in the arduino builder script.

My bad, I did not read this properly, this is expected behavior due to how the library dependency finder (LDF) works. If your library where you include EEPROM is not included in the main code file, the LDF will not find it. There must be an inclusion chain from your firmware in src/ to your library in lib/ where the EEPROM.h is used.

When Replace LDF deep with native GCC Preprocessor · Issue #3113 · platformio/platformio-core · GitHub is implemented this should work better.

If in no case it would find EEPROM.h, even if included directly in main.cpp, then it would be a problem in the builder script, but as you said that that works, no issues there.

Hi Max,

Thank you for clearing that up, we are new to the intricacies of platformio.

G