PlatformIO Community

PlatformIO not installing all framework files needed for a new project

I had VSCode installed to a secondary drive (“M” drive). I store my PIO projects but everything else PIO wanted to store on the C drive which was fine.
I have a problem with my pc at the moment, so I decided to re-install Windows. This was not a problem since everything was on a external drive, which I could just set up on the new Windows install. The only files I’d lost are things like the PIO framework files. I thought this would be fine because PIO would redownload them.

On the new Windows install, I opened VSCode and installed PIO. I then went straight to make a new project. I selected the Espressif ESP32 Dev Module with the Arduino framework. It downloaded what I though was all the files I needed, without any errors, and let me continues. I also installed the dependencies I needed. I then copied code the code in from the previous project and I was hit with some errors. One of the main ones is that I am missing “Arduino.h”. This seems to be a common problem and it often seems to be just an error where VSCode is unable to find the file, but the project still. For me, it’s missing entirely and I can’t even build.

Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
src\main.cpp:1:21: fatal error: Arduino.h: No such file or directory

I decided to look at the c_cpp_properties.json file and compare it to the one from the project on my old Windows version. My current one looks like this:

"name": "PlatformIO",
    "includePath": [
        "m:/Dexter/Documents/PlatformIO/Projects/Magic Light/include",
        "m:/Dexter/Documents/PlatformIO/Projects/Magic Light/src",

My old one has many, many paths like this:


I tried copying these over into my current file and I got lots of warnings saying the file could not be found.
It turns out the entirety of “/tools/” and “/libraries/” under “/.platformio/packages/framework-arduinoespressif32/” just don’t exist. They were never downloaded by PIO.

I did not create a new project in a different way to last time, but now I am missing a load of these files. There are no console errors when creating a new project so it’s not like it can’t download them or something.
I mean, I could be wrong in saying that these files are downloaded when you create a new project but I definitely didn’t add them myself last time, so something has gone wrong somewhere.

Does anyone know how to fix this? I am unable to build/use any libraries without these files.

I got it working by just downloading the file straight from the GitHub page. Although git was installed, because it’s a new windows it was on the path so it couldn’t be called from cmd. Would that make a difference? I assume not otherwise it wouldn’t have been able to download of the files.

If the project still has oldpaths like that in the c_cpp_properties.json, you need to execute the project task “Miscelleneous -> Rebuilt IndelliSense”.

A newly cloned project will have the good paths automatically since it’s re-inited on startup.

1 Like