Unable to compile marlin 2.1.2.1 firmware in vscode

I’ve been unable to compile Marlin firmware for a couple of days. I’ve tried re-installing vscode, platformio and auto build marlin multiple times with no success. I keep consistently getting the error: collect2.exe: error: ld returned 1 exit status. It always happens after it starts linking firmware.elf and is then followed by a bunch of undefined references to millis in a file I cannot find.

Any help would be greatly appreciated
There is also the log if it is helpful

PS C:\Marlin-2.1.x> platformio run -e mega2560
Processing mega2560 (board: megaatmega2560; platform: atmelavr@~4.0.1; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR (4.0.1) > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr @ 5.1.0
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting Marlin.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wire @ 1.0
|-- SPI @ 1.0
Building in release mode
Compiling .pio\build\mega2560\src\src\HAL\AVR\HAL.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\AVR\HAL_SPI.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\AVR\MarlinSerial.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\AVR\Servo.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\AVR\eeprom.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\AVR\fast_pwm.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\AVR\fastio.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\AVR\u8g_com_HAL_AVR_sw_spi.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\shared\Delay.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\shared\HAL.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\shared\MinSerial.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\shared\eeprom_api.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\shared\esp_wifi.cpp.o
Compiling .pio\build\mega2560\src\src\HAL\shared\servo.cpp.o
Compiling .pio\build\mega2560\src\src\MarlinCore.cpp.o
Compiling .pio\build\mega2560\src\src\core\serial.cpp.o
Compiling .pio\build\mega2560\src\src\core\utility.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\calibrate\G28.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\config\M200-M205.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\config\M220.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\config\M221.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\config\M301.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\config\M302.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\config\M309.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\config\M92.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M108_M112_M410.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M111.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M120_M121.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M17_M18_M84.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M211.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M400.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M80_M81.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M85.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M993_M994.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M997.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\M999.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\control\T.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\eeprom\M500-M504.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\feature\digipot\M907-M910.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\gcode.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\gcode_d.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\geometry\G92.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\geometry\M206_M428.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\host\M110.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\host\M113.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\host\M114.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\host\M115.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\host\M118.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\host\M119.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\motion\G0_G1.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\motion\G2_G3.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\motion\G4.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\parser.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\queue.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\stats\M31.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\stats\M75-M78.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\temp\M104_M109.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\temp\M105.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\temp\M106_M107.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\temp\M140_M190.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\temp\M141_M191.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\temp\M155.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\temp\M303.cpp.o
Compiling .pio\build\mega2560\src\src\gcode\units\M82_M83.cpp.o
Compiling .pio\build\mega2560\src\src\inc\Warnings.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\extui\ui_api.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\fontutils.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\marlinui.cpp.o
Compiling .pio\build\mega2560\src\src\libs\buzzer.cpp.o
Compiling .pio\build\mega2560\src\src\libs\crc16.cpp.o
Compiling .pio\build\mega2560\src\src\libs\numtostr.cpp.o
Compiling .pio\build\mega2560\src\src\libs\stopwatch.cpp.o
Compiling .pio\build\mega2560\src\src\libs\vector_3.cpp.o
Marlin\src\inc\Warnings.cpp:67:4: warning: #warning "Your Configuration provides no method to acquire user feedback!" [-Wcpp]
   #warning "Your Configuration provides no method to acquire user feedback!"
    ^~~~~~~
Compiling .pio\build\mega2560\src\src\module\endstops.cpp.o
Compiling .pio\build\mega2560\src\src\module\motion.cpp.o
Compiling .pio\build\mega2560\src\src\module\planner.cpp.o
Compiling .pio\build\mega2560\src\src\module\settings.cpp.o
Compiling .pio\build\mega2560\src\src\module\stepper.cpp.o
Compiling .pio\build\mega2560\src\src\module\stepper\indirection.cpp.o
Compiling .pio\build\mega2560\src\src\module\temperature.cpp.o
Compiling .pio\build\mega2560\src\src\module\tool_change.cpp.o
Compiling .pio\build\mega2560\lib0fb\Wire\Wire.cpp.o
Compiling .pio\build\mega2560\lib0fb\Wire\utility\twi.c.o
Compiling .pio\build\mega2560\lib17f\SPI\SPI.cpp.o
Archiving .pio\build\mega2560\libFrameworkArduinoVariant.a
Compiling .pio\build\mega2560\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\HardwareSerial1.cpp.o
Archiving .pio\build\mega2560\lib17f\libSPI.a
Compiling .pio\build\mega2560\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\IPAddress.cpp.o
Archiving .pio\build\mega2560\lib0fb\libWire.a
Compiling .pio\build\mega2560\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\Print.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\USBCore.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\WInterrupts.c.o
Compiling .pio\build\mega2560\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\WString.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\abi.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\hooks.c.o
Compiling .pio\build\mega2560\FrameworkArduino\main.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\new.cpp.o
Compiling .pio\build\mega2560\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\mega2560\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\mega2560\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\mega2560\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\mega2560\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\mega2560\libFrameworkArduino.a
Linking .pio\build\mega2560\firmware.elf
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `Temperature::analog_to_celsius_hotend(unsigned int, unsigned char) [clone .constprop.63]':
<artificial>:(.text+0x15bc): undefined reference to `millis'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `Temperature::_temp_error(heater_id_t, __FlashStringHelper const*, __FlashStringHelper const*)':
<artificial>:(.text+0x17da): undefined reference to `millis'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `Temperature::task()':
<artificial>:(.text+0x18ea): undefined reference to `millis'
<artificial>:(.text+0x1cc8): undefined reference to `millis'
<artificial>:(.text+0x1d14): undefined reference to `millis'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o:<artificial>:(.text+0x1d90): more undefined references to `millis' follow
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `Planner::calculate_trapezoid_for_block(PlannerBlock*, float const&, float const&)':
<artificial>:(.text+0x24a8): undefined reference to `delay'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `idle(bool) [clone .constprop.55]':
<artificial>:(.text+0x27f0): undefined reference to `millis'
<artificial>:(.text+0x28fc): undefined reference to `millis'
<artificial>:(.text+0x293a): undefined reference to `millis'
<artificial>:(.text+0x2cda): undefined reference to `millis'
<artificial>:(.text+0x2d54): undefined reference to `millis'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `homeaxis(AxisEnum) [clone .part.6]':
<artificial>:(.text+0x551c): undefined reference to `delay'
<artificial>:(.text+0x552a): undefined reference to `delay'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `GcodeSuite::M104_M109(bool)':
<artificial>:(.text+0x5a52): undefined reference to `millis'
<artificial>:(.text+0x5ad2): undefined reference to `millis'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `GcodeSuite::process_parsed_command(bool) [clone .constprop.9]':
<artificial>:(.text+0x6696): undefined reference to `millis'
<artificial>:(.text+0x66a2): undefined reference to `millis'
<artificial>:(.text+0x66f2): undefined reference to `millis'
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o:<artificial>:(.text+0x699e): more undefined references to `millis' follow
C:\Users\crowe\AppData\Local\Temp\cc7WuyNm.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0xb4): undefined reference to `init'
<artificial>:(.text.startup+0xf4): undefined reference to `millis'
<artificial>:(.text.startup+0x24e): undefined reference to `millis'
collect2.exe: error: ld returned 1 exit status