Error : showing up on every project

Hello world ! :sweat_smile:
Here’s my problem : A few days ago an error started to showing up preventing me from building my code.
So I spent quite a lot of time trying to resolve. Then I noticed that the code inside my project didn’t matter.
In fact I started a brand new project and I had the same message :
This is the brand new code :

#include <Arduino.h>

void setup()
  Serial.println("Hello world !");

void loop()

Here is the message :

Building in release mode
Compiling .pio\build\megaatmega2560\src\main.cpp.o
Compiling .pio\build\megaatmega2560\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\megaatmega2560\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\megaatmega2560\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\megaatmega2560\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\megaatmega2560\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\megaatmega2560\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\megaatmega2560\FrameworkArduino\IPAddress.cpp.o
In file included from C:\Users\Simon\.platformio\packages\framework-arduino-avr\cores\arduino/Print.h:24:0,
                 from C:\Users\Simon\.platformio\packages\framework-arduino-avr\cores\arduino/Stream.h:26,
                 from C:\Users\Simon\.platformio\packages\framework-arduino-avr\cores\arduino/HardwareSerial.h:29,
                 from C:\Users\Simon\.platformio\packages\framework-arduino-avr\cores\arduino/Arduino.h:233,
                 from src\main.cpp:1:
c:\users\simon\.platformio\packages\toolchain-atmelavr\avr\include\stdio.h:610:56: error: 'va_list' has not been declared
 extern int vfprintf(FILE *__stream, const char *__fmt, va_list __ap);
c:\users\simon\.platformio\packages\toolchain-atmelavr\avr\include\stdio.h:616:58: error: 'va_list' has not been declared
 extern int vfprintf_P(FILE *__stream, const char *__fmt, va_list __ap);
// I cut the message here because is a very long message that exceeds the limit. Also it does just repeat the same thing for a bunch of others files
In file included from C:\Users\Simon\.platformio\packages\framework-arduino-avr\cores\arduino\IPAddress.cpp:21:0:
C:\Users\Simon\.platformio\packages\framework-arduino-avr\cores\arduino/IPAddress.h:29:36: error: expected class-name before '{' token
 class IPAddress : public Printable {
*** [.pio\build\megaatmega2560\FrameworkArduino\HardwareSerial3.cpp.o] Error 1
*** [.pio\build\megaatmega2560\FrameworkArduino\IPAddress.cpp.o] Error 1
*** [.pio\build\megaatmega2560\FrameworkArduino\HardwareSerial1.cpp.o] Error 1
====================================================== [FAILED] Took 0.95 seconds ======================================================

The terminal process "C:\Users\Simon\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

I never touched such files. So I’m asking for help because I don’t know where to look to make this error disappear. My guess is that I felt asleep and accidentally start to change code in files that I wasn’t even aware of :sweat_smile:

This error shows up even on a completely blank main.cpp file. I tryed to uninstall and install again PlatformIO hoping I did it right.

Maybe there is a conflict with an extension. Last extension I installed was Edit CSV. But it worked fine for a while after.

Notice that I have no problems with Arduino IDE. But I enjoy Platformio combined with VSCode too much to give up so quickly.

I’m clueless.
Thank you very much in advance for whoever will try to help.

A bug in VSCode’s C/C++ extension might have destroyed your toolchain or Arduino packages. Please see PlatformIO is Broken for any esp32! - #17 by slopsjon to ensure that the extension’s version is from the stable channel.

Then, remove all folders inside C:\Users\Simon\.platformio\packages\, C:\Users\Simon\.platformio\platforms\ and C:\Users\Simon\.platformio\.cache and rebuild the project. PlatformIO will redownload its needed packages.

1 Like

So… I switched my C++ extension to release version.
Uninstall and install platformIO.
Deleted the build folder and rebuild.
Same issue.

Thank you I’ll try that