I have read the “platformio lib install” doc, however i’m not sure i understand how to do a very simple thing.
I created a small library for the esp8266, using the “arduino library rules”, it is stored on my computer in D:\library_test . I am using platformIO with atom.
I just want to be able to create as many projects i want in platformIO, and be able to add my library this way as i do with other libraries :
#include "library_test"
Now is that even possible ? I’m sorry if that sounds stupid, i am still learning.
It is,
You can place a copy of the library under the lib folder in your project folder and include it from there.
Or you can define lib_extra_dirs path to point to your custom library and still include it from there in your project.
About the: define a lib_extra_dirs path…Where am i supposed to define it. I read the docs again and they give this example:
[env:myenv]
lib_extra_dirs = /common/libraries
I mean if i’m supposed to be add this to the platformio.ini file, the problem is that, as each project has its own platformio.ini file, it means i will have to add this line every time i create a new project, and my “goal” would be to simply be able to add libraries from a “global” folder by simply including them with an #include, like you can do in the Arduino IDE, but may be it is not possible (?)
Yes, that is correct. You will have to manually add that particular directive to all your projects. It is a small inconvenience but it does serve your purpose.
Though you might want to reach out to @ivankravets to ask if there is a way to install the specific custom library what you create in the global library storage of platformio. That way it is accessible to all the projects inside platformio.
3 folders for 3 personal libraries, each one with its .h and .cpp file.
for simplicity let’s call these forders: myLib1, myLib2, myLib3
4 .h files
for simplicity let’s call them UX1.h, UX2.h, myglobalsMain.h, mydebug.h
2 out of the four .h in lib are for main.cpp, namely UX1.h and UX2.h
while myglobalsMain.h (defines and globals) is common to both main.cpp and one of my library, say myLib3
while mydebug.h (C pre-processing) is common to all three libraries and main.cpp as well
PlateformIO informs me that I’m left with “5 problems”.
it claims that it can’t open the source file “mydebug.h”, so as the other .h files directly under lib
I found the solution: is to move the mydebug.h and myglobalsMain.h to the include folder.
Would you be so kind to add to
that shared includes must be in the include directory