Correct organization and linking of multiple cpp and h files

Correct, .c/.cpp files in include/ are not compiled ("added to the build system to produce a .o object file that will be linked in the final .elf).

If foo.h is in include/, this is correct. Libraries by default don’t see the files in include/ without the user explicitly adding build_flags = -Iinclude/ in the platformio.ini.

If lib/bar/* depends on a foo.h file, then foo.h should either be in a library (so that the LDF can detect a dependency to it and include it), or if that file truly belongs to the project itself, add the build_flags as above.

1 Like