Hi - I am a pretty new user of PIO and today set up a trial header file to forward declare functions and a functions definitions file. I read the readme in the include folder and it says this :
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in
by including it, with the C preprocessing directive `#include’.
The use of double quotes in the line above is indicative of user libraries not system libraries.
Now moving on to the readme in the lib directory:
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
(“lib/your_library_name/[here are source files]”).
For example, see a structure of the following two libraries
| | |–docs
| | |–examples
| | |–src
| | |- Bar.c
| | |- Bar.h
and lower down the text another exerpt:
and a contents of
int main (void)
The includes in this excerpt use < > which as I understand it, indicates system libraries, not user libraries.
For my user libraries, which I set up today, I used the structure indicated in the PIO lib readme and this worked. I included my user libraries as #include " " (double quotes)
So, could I gently suggest that the readme files need a bit of a review? It seems the PIO include folder is for system libraries and the PIO lib folder structure is for user libraries.
Caveat - today is the first time I have ever written a .h file and an associated .cpp functions definitions file. It all worked out in the end, but the readmes confused me a bit.
PIO is a really nice environment and I’m really enjoing using it.