Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow libraries to be loaded from sketch / project folder #4936
This is an issue that must have wasted hours for many people, as some sources on the internet hint that there is a possibility to do it but it's actually not.
What is possible now:
What we all want
This doesn't seem to be possible without a (big ass) Makefile.
The problem with the current options:
Is there really no way we can have relative includes at the moment?
If not, please allow it or at the very least check if there is a libraries folder inside of the sketch / project directory and link those correctly
It is now possible to do this. Note that the files outside the
and the include statement in MyProject.ino:
@per1234's solution doesn't seem to solve this issue because:
@vespakoen's points still apply, it is impossible to distribute libraries with the sketch using the official Arduino tools.
With arduino-cli it is now however possible to install libraries from CLI, making it easy to install libraries from a Makefile (example). It is possible to specify library's version, installing two versions of the same library is still not possible though.
Meh. I'm not buying it.
A little inconvenient, but I think "ugly hack" is going too far.
No. The src folder system provides exactly what vespakoen requested.
Come on. That's clearly a false statement. Perhaps it's possible to improve, but it absolutely is possible.
I've just tried it and, while the
Should have asked. You're right and I'm sorry.
Btw, is this covered in any docs somewhere or one has to read the sources?
Ah, I see now. It was my text representation of the folder structure. It indeed would be unacceptable if there was some required filename prefix. Sorry for the confusion.
No apologies necessary. I think it's possible there is a better solution to the general problem of bundling libraries with sketches. It's just that this particular feature request of vespakoen has been resolved. Other possibilities are:
This is actually less applicable to this request since it won't allow different library versions to be used.
I'm not sure I completely understand that PR, but this comment shows a lot of promise. If we could add a
Unfortunately no. This is one of quite a few useful features that were never documented. I think the root problem is that there is not currently a good place to document it. I think the ideal location would be an "Arduino Sketch Specification", just as we already have for hardware packages, libraries, and Boards Manager JSON files. I brought that up in the developers mailing list some time ago but didn't get any response. I suppose I should probably just go ahead and do it and hope nobody minds.
Wish ArduinoIDE can find the archive libraries (.a) into