Where are my Wire.h, SPI.h and other libraries located ? (linux)


Where are my Wire.h, SPI.h and other libraries located on my linux machine ?

The location of the active versions of those libraries can be dependent on which board you have selected from the Tools > Board menu or whether you have installed an update via Boards Manager.

The easiest way to find the active hardware package location is as follows:

  • Select a board from the hardware package from the Tools > Board menu
  • File > Examples > SPI > BarometricPressureSensor (or any other example sketch of the library)
  • Sketch > Show Sketch Folder


So it shows only 5 built-in libraries !
EEPROM HID SoftwareSerial SPI Wire
Is it normal ?

I'm trying to configure vscode and I'm facing the biggest problem !

Those are the architecture-specific libraries bundled with the hardware package. There are other libraries bundled with the Arduino IDE in a different folder (the libraries subfolder of the Arduino IDE). You can use the same process, only with a different library’s (e.g. Ethernet) examples to find those.

3rd party libraries or libraries you update via Library Manager are installed to yet another location (the libraries subfolder of the sketchbook folder).

OK, I've just understood there was different locations !

But as I said, I'm trying to configure vscode and I guess I must give all the possible path !

I'm having the hardest time to do it.

Would you be of any help ? I wonder if vscode is a good direction.

You need to understand that the Arduino IDE’s #include search path changes depending on which board you have selected. If you’re only using one hardware package (e.g. Arduino AVR Boards) then that’s not a problem but if you want to use multiple packages (e.g. Arduino SAMD Boards, ESP8266 core for Arduino, ESP32 core for Arduino) then it will cause big problem to have all their bundled libraries in the #include search path.

I think you need to accept that using any alternative IDE will introduce a lot of additional difficulties, not only in initial setup but also ongoing as you find that code that runs fine in the Arduino IDE does no in the alternative IDE. So you need to evaluate whether the additional features are worth it.

If it’s only the Arduino IDE’s editor you don’t like, you might consider using an external editor (File > Preferences > Use external editor) and just use the Arduino IDE to compile and upload the code. The Arduino IDE does have a command line interface if you don’t want to use its GUI for this.

I don’t know whether there is a good existing tutorial for using VS Code with Arduino. If not, you might look for information about using VS Code with Platformio.

Platformio ?

Yes I've found that but still some problems !