How to set the include path for the entire workspace

Hi,
I’m in the process to transition from Arduino-IDe to VSCode-PlatformIO and have a ‘rookie’ question.
I’m hoping this is the right forum for my question. If not, please let me know.

I created a workspace for several ‘Arduino sketches’ and I would like to set an include path for the entire workspace.
All libraries are located in a central location on a NAS. Each library has its own folder inside the library.
e.g.
/mnt/
→ FastLED/
→ Adafruit_NeoPixel-master
→ LiquidCrystal, a.s.o.
How would I setup an include path for the whole Workspace?
Is that possible in VSCode-PlatformIO?
Any suggestion is much appreciated.
TIA

Hi dbyy!

That’s not a good idea and always lead to errors in the past.
Haveing just a single project open in VS Code at a time will save you headache.

In PlatformIO, libraries are installed per project for a good reason: reproducibility.

You can specify the exact version number of the library to be used!

Imagine you have two projects that use ArduinoJson. Project A requires ArduinoJson 5.1 and Project B requires ArduinoJson 7.2!

If you use a “global installed” version of ArduinoJson you can either build Project A or Project B, but not both!

This can be easily solved with PlatformIO in the platformio.ini

Project A:

lib_deps = blanchon/ArduinoJson @ ^5.1.0

Project B:

lib_deps = bblanchon/ArduinoJson @ ^7.2.0

But there are good reasons for local libraries, e.g. if you are writing your own libraries. How to solve this - and this is the answer to your question - See
How to use a local custom library

Besten Dank Boris,

I see your point and it makes sense.
I’ll try to find the best solution for my scenario.
Grüsse nach D.

Ich bin ursprünglich aus Neuss, now Sudbury, Canada.

1 Like