'No such file or directory' with Servo.h


I have just installed PlatformIO today and wanted to use a code with “Servo.h”, however even if my LSP works and has the path to it my project won’t build.

I first added
lib_deps=arduino-libraries/Servo@^1.2.1 under [env:uno] and this was not even recognized by the LSP though it was downloaded under .pio/libdeps.
I then put it under [env] and now it is somewhat accepted by the LSP, I can CTRL+Click in order to get to the source file. But it will still not compile.

How can I fix this ?


Full platformio.ini, code and error message?

Sure, I will paste the configuration file as I can only embed one file per post :

lib_deps = 

platform = atmelavr
board = uno
framework = arduino

Here is the only file in the project too :

#include <Arduino.h>
#include <Servo.h>

Servo servo;

void setup() {
  // put your setup code here, to run once:
  //int result = myFunction(2, 3);

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(LED_BUILTIN, HIGH);


  digitalWrite(LED_BUILTIN, LOW);


And here is the end of the compilation process, before are warnings :

/mnt? Are you trying with VSCode connected to WSL or a devcontainer? I wouldn’t bet on that working.

The code and platformio.ini all look fine. Try to delete the .pio folder of the project and rebuild normally.

There is nothing special about that /mnt folder, it’s not WSL nor a devcontainer.
After deleting the .pio folder I pressed again CTRL+ALT+B to build and I am still getting the same error.
Deleting the folder again then executing PlatformIO: Rebuild IntelliSense Index does not work either.

Can you provide a full screenshot of VSCode with the “File Explorer” sidebar opened?

No problem. I think I opened everything that was necessary, here is the full screenshot with the sidebar opened.

That should not be possible.

Have you tried to create a clean project somewhere in the regular /home/ directory? Have you disabled all extensions except C/C++ by Microsoft and PlatformIO? You are using the regular VSCode and not VSCodium / OSS VSCode?

I am indeed using VSCodium and that might be the issue, I did install the C/C++ extension by Microsoft through the VSIX file. Is there anything else I should do to make PlatformIO work ?

Confirm that by temporarily switching to regular VSCode and see if all your issues disappear.