The /lib folder states that it’s meant for private project libraries, but it also seems to me like the /include folder could be used very similarly, just that the /include folder should just be typically for headers. So would you make your header files in /include, and have your source files for them in /src? What is the main difference between /lib and /include
When a library, in lib
, is being compiled, the include
folder is not scanned for header files. For libraries in lib/mylib
header and cpp filrs should, normally, be together - for example, mylib.h
and `mylib.cpp.
The include
folder is scanned when compiling your actual sketch files.
Speakinfg personally, my sketch’s cpp files, and header files usually all live together in src
. I don’t use include
. Other people keep cpp files in src
and headers in include
– PlatformIO gives you the choice.
lib
is also where downloaded libraries are saved to. These are the ones mentioned in the lib_deps
section of platformio.ini
.
HTH
Cheers,
Norm.