"Filename or extension is too long" compilation error

Hi, I'm using Arduino Nano 33 BLE with Edge Impulse. I have problem compiling my code right now as I keep getting the same error below:

fork/exec C:\Users\Edzham\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++.exe: The filename or extension is too long.
Error compiling for board Arduino Nano 33 BLE.

I tried searching online for solution, some people suggested to modify preferences.txt as shown below, which I already did:

However, I still keep getting the same problem. I even tried running Arduino 1.9.0 Beta but still cannot build it. Any suggestion on how to solve this problem?

Have you tried renaming the file to something really short?

JohnLincoln:
Have you tried renaming the file to something really short?

The filename itself is not the problem. This is a known problem with Marlin where the linker command issued by the Arduino IDE is exceeding the maximum size of 32767 characters allowed on Windows. The modification to preferences.txt that the OP linked is setting the temporary build directory to a directory at the root of the hard drive to shorten the file paths, but apparently that is not enough in this case. The link uses C:\marlin, I would try using a single letter for the directory name, such as C:\m (make sure there is not already a folder with that name at C:\ just to be safe).

The problem is specific to the operating system and the Arduino IDE, using Visual Studio to compile the code is suppose to work, although I've never tried. The problem also does not occur when using a system running linux.

david_2018:
The filename itself is not the problem. This is a known problem with Marlin where the linker command issued by the Arduino IDE is exceeding the maximum size of 32767 characters allowed on Windows. The modification to preferences.txt that the OP linked is setting the temporary build directory to a directory at the root of the hard drive to shorten the file paths, but apparently that is not enough in this case. The link uses C:\marlin, I would try using a single letter for the directory name, such as C:\m (make sure there is not already a folder with that name at C:\ just to be safe).

The problem is specific to the operating system and the Arduino IDE, using Visual Studio to compile the code is suppose to work, although I've never tried. The problem also does not occur when using a system running linux.

It works, I tried to compile on platformio using Visual studio code and it works as expected. I only had to import the .ino file and the rest is done by the compiler. For your information this has nothing to do with Marlin I think, as it is used for different purpose but I really hope Arduino can sort this problem out on the Arduino IDE.

edzham:
It works, I tried to compile on platformio using Visual studio code and it works as expected. I only had to import the .ino file and the rest is done by the compiler. For your information this has nothing to do with Marlin I think, as it is used for different purpose but I really hope Arduino can sort this problem out on the Arduino IDE.

True, it is not a Marlin specific problem, it was just that you linked a discussion about Marlin, and the problem shows up under certain configurations of that code. As far as I understand it, the problem comes from having a large number of files that need to be linked together after compilation, which can happen when you are using a library that depends upon multiple other libraries, which in turn need even more libraries. There is something in the way the Arduino IDE generates the linker command that makes it very long - when I was testing the Marlin code on linux, the linker command line had a bit over 34,000 characters.