Using a custom library in a custom library

Hello,
I’m new to platformio so sorry if this question has already been answered, but I can’t seem to find a solution that works for me.

I’m trying to import a library into a file that is also in the lib folder, but it can’t seem to see it.
In this case I have a file with a bunch of bitmap images but this seems like a fairly normal thing to want to do with other functions.

Please let me know if I am missing something obvious.
Thanks.

Changing #include <bitmaps.h> (global include) to #include "bitmaps.h" (local include) should do the trick.

1 Like

Thank you so much! I wasn’t aware of local vs global includes. That fixed it.

1 Like

In PlatformIO, each folder inside lib/ is treated as a separate library. So if you just drop multiple .h / .cpp files directly inside lib/ without putting them in their own subfolders, they won’t automatically see each other.

The usual structure should look like this:

lib/ MyImages/ MyImages.h MyImages.cpp MyDisplay/ MyDisplay.h MyDisplay.cpp

Then inside MyDisplay, you include it like:

#include <MyImages.h>

If both files are meant to be part of the same library, they should live inside the same subfolder under lib/. In short: each library needs its own folder. such as iOS , PlatformIO doesn’t treat the whole lib/ directory as one big shared space.