Not planned
Description
Describe the request
The sketch folder structure described in the arduino-cli documentation does not work (i.e. the libraries added in the sketch folder can not be found by both the arduino-cli and the arduino-builder
Describe the current behavior
It returns the error below when one tries to compile a sketch with a library whose location is within the sketch folder itself
> fatal error: SomeLib.h: No such file or directory
Arduino CLI version
1.1.1
Operating system
Linux
Operating system version
24.04
Additional context
If the build procedure can be made in such a way that the build process (both the cli & builder) checks the sketch folder for libraries first before the Arduino/libraries
and /home/<user>/.arduino15/packages/<platform>/hardware/<core>/<version>/libraries
locations that would be great and in adherence to the sketch folder structure specification
Issue checklist
- I searched for previous requests in the issue trackerI verified the feature was still missing when using the nightly buildMy request contains all necessary details
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
fedy0 commentedon Nov 22, 2024
Additionally, this feature can also be added in
sketch.yaml
file as show below. This will enable the addition of third party libraries or self developed libraries.per1234 commentedon Nov 22, 2024
Hi @fedy0.
Even though the example in the specification shows the common use case of bundling a library's files with a sketch, the files in the
src
subfolder of the sketch are not treated as libraries. They are only additional files of the sketch. For this reason, you must use the relative path to the file in the#include
directive. In the example shown in the specification, if you wanted to add an#include
directive forSomeLib.h
toFoo.ino
, it would look like this:I see we have another request for this feature at #1255.
I see we have another request for this feature at #2133
It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the previous feature requests.
sketch.yaml
#2133fedy0 commentedon Nov 26, 2024
Hi
The relative path doesn't work that's why I opened this request.
Nevertheless, thank you for your prompt response.
per1234 commentedon Nov 26, 2024
It works just fine for me, and for the many other users who use this feature. So I suspect user error. If you post over on Arduino forum I'm certain we will be able to help you get it working:
https://forum.arduino.cc/