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", "C:/Users/Dexter/.platformio/packages/tool-unity", "" ],
My old one has many, many paths like this:
"C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_trace", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_update", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/asio", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bootloader_support", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bt", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/coap", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/console", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/driver", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp-tls", "C:/Users/Dexter/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp32",
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.