Source Code Can't find files that are interdependent

So I have a bunch of source files that I want to use in my platformio project. I have been putting them all in lib/private_lib and my project runs fine. But I have like 50 files in that folder. The files are really source files so I moved them to the src/ folder. The graph below represents my basic file structure.

|–src
| |-Bar
| | |- Bar.c
| | |- Bar.h
| |–Foo
| | |- Foo.c
| | |- Foo.h //contains #include “Bar.h”
| |–Main
| | |- Main.cpp

So when I try to do platformio run it tells me that Bar.h does not exist. So platformio found Foo.h but then it couldn’t go find bar.h.

How do i fix this?

Sorry if this question has been asked before, I couldn’t find it.

Could you provide a bare project with this structure to reproduce this issue?

thanks for the fast reply.

I couldn’t even reproduce the issue. This project can’t even find Foo.h in the first place.

If you could help with that I would love it.

What are you doing? Why did you move libraries to src folder? The ROOT is src folder. If you want to use libraries in src folder, you need to specify FULL RELATIVE PATH. For example, this line should look as #include "Foo/Foo.h".

PlatformIO Core doesn’t parse src folder for the libraries. Also, you can pass custom includes to CPPPATH. See Redirecting...

Huh, didn’t know those files were libraries. Thanks for the help! I moved them into the lib folder and it worked perfectly

There is a big difference between src and lib folder. PIO looks for the libraries in the multiple library storages and builds them to real static libraries. Take a look at Library Dependency Finder (LDF) — PlatformIO latest documentation