PlatformIO Community

Library dependecies


#1

Hello everyone.

I wrote some classes for my arduino projects which are under a shared /libraries folder. It worked so far since every class only consists of a header file with no dependencies to other custom classes.

In the platformio.ini I used

lib_extra_dirs = /media/stefan/DATA/electronics/atom/libaries

where every class has its own folder

Now I would like to include classes from my library.

---- libraries
 |---- Testclass
    |---- Testclass.h
    |---- Testclass.cpp
 |---- Realclass
    |---- Realclass.h
    |---- Realclass.cpp

‘Realclass.h’ needs ‘Testclass.h’ but does not recognise its reference

I tried using

#include "Testclass.h"
#include "Testclass/Testclass.h"
#include <Testclass.h>
#include <Testclass/Testclass.h>

the only working “solution” is to include the whole path of the file, which just invites inconsistencies moving projects.

Is there a way to include custom libraries so platformIO links the necessary files beforehand?

Thanks.


#2

Just use #include <Realclass.h>, PlatformIO LDF will find all dependencies automatically.