Error undifined reference to

#include <Arduino.h>

#define LED 2

void setup() {
// put your setup code here, to run once:
pinMode(LED, OUTPUT);

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

This is my code very simple with here no errors but when i try and run it I have those errors :

C:\Users\jauda\AppData\Local\Temp\ccB7euus.ltrans0.ltrans.o: In function `main’:

:(.text.startup+0x0): undefined reference to `init’

:(.text.startup+0x4c): undefined reference to `delay’

:(.text.startup+0x5e): undefined reference to `delay’

collect2.exe: error: ld returned 1 exit status

*** [.pio\build\nanoatmega328\firmware.elf] Error 1

and I searched on internet but didn’t find any answer so I try here

What is your platofrmio.ini?

Are you writing your code in a src/main.cpp file (correct) or src/main.c file?

I’m writing in a src/main.cpp file and how do I know which platofrmio.ini ?
Maybe it is this the platformio.ini :
platform = atmelavr
board = nanoatmega328
framework = arduino

Find and delete the folder C:\Users\<user>\.platformio\packages\framework-arduinoavr and build the project again.

It worked for one time and then just when I try and rebuild it a second time the error reappears
Well it works when i uninstal it so i am going to uninstal it evrytime i am going to build it and it will work