Filename/Extension to long

when trying to compile a 3d printer software i get this error no matter where i move it to it always comes back with the same error.

fork/exec C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc.exe: The filename or extension is too long.
Error compiling for board Arduino Mega or Mega 2560.

Please copy and post the entire literal error message. Unless, that is the whole thing.

thats the whole thing

Alright then, post the 3D printer software. It may be too large, if so just add as an attachment. Please also don't continue to hide the rest of the information, like what board you have, what IDE, etc...

its a marlin firmware that i am trying to compile for a MKS Gen L board with a ATMega2560 its has a boot loader flashed to it so im trying to compile it via USB

Marlin.ino (2.12 KB)

Configuration_adv.h (143 KB)

Configuration.h (89.6 KB)

Version.h (2.46 KB)

Which version of the Arduino IDE are you using? This appears to be a known problem with Marlin 2.0 when compiled on Windows, but may have been fixed in the latest versions of the IDE. The error is caused by the IDE generating a command with a very long list of files for the linker, which exceeds Window's limit of 32767 character for a command line.

im currently running version 1.8.13 so i should compile using Ubuntu or OSX?

If you have a computer with Ubuntu use that, it compiles successfully for me. Do not have any way to test with OSX.

There have also been suggestions of putting the directory with the marlin code at the root of the hard drive on Windows, in order to shorten the file path. Using Ubuntu the linker command has 34,394 characters on my system, well in excess of the limit on Windows (and is of course dependent on where the sketch is located).