IDE 2.0.3 - Project-shared folders (non-library folder)

Sometimes it is necessary to maintain common files with subroutines for a project consisting of several sketches.

Can I do this in newer versions IDE (by specifying relative paths or some other way)?

Hi @n_a. It is not possible to do this via relative paths because the sketch is copied to a temporary folder when Arduino IDE converts it to a C++ program for compiling.

You can use absolute paths, but the library won't be compiled so you can only use the code in the #included file when you do that, instead of from all the source files of the library as is the case when you use libraries in the usual way. So this approach is only feasible in the case of a "header-only" library. And of course the use of absolute paths harms the portability of the project.

What is your reason for not wanting to to put the shared code in a library in the standard library installation folder?

For example, special init procedures (and function sets), or their own set of constants (tokens, tune values), or modified functions from libraries that are specific only to this project.

One solution would be to use a dedicated sketchbook folder for the project. This folder would contain the project sketches and the library dependencies of the project. You can set the sketchbook folder location in the "Sketchbook location" field of the Arduino IDE preferences (accessed via the File > Preferences menu on Windows and Linux or the Arduino IDE > Settings menu on macOS).

Thanks, I'll try it!

I didn't consider these settings as project-dependent before. Interesting!

You are welcome. I'm glad if I was able to be of assistance.

Please let us know if you have any questions or encounter any problems. I know some of the other forum members use this sketchbook approach to create semi-isolated "environments" for projects so I'm sure we can provide more advice on the subject.

Regards,
Per