Error compiling for board Arduino/Genuino Mega or Mega 2560.

it worked for my other projects and then it just stops working.

(deleted)

It's the "cannot rename core/core.a: permission denied" issue.

I forget how to fix that. Was that the one that comes from an overly aggressive antivirus blocking the compiler from doing it's thing?

Arduino: 1.8.1 (Windows Vista), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

c:\program files (x86)\arduino\hardware\tools\avr\bin../lib/gcc/avr/4.9.2/../../../../avr/bin/ar.exe: unable to rename 'core\core.a'; reason: Permission denied

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

The best bet just to start with.

Slow compiles under Windows or permission denied

Add the Arduino directories to your antivirus / anti malware / other security exclusions.

So that would be at least two of the following.

C:\Program Files (x86)\Arduino
C:\Users\yourname\AppData\Local\Arduino15 depends on IDE
C:\Users\yourname\AppData\Roaming\Arduino15 depends on IDE

If you have your sketches set up in a different location it’s also worth adding that directory to the exclusions also.

Additionally if you also use the online IDE “CREATE” the following directories.

C:\Users\yourname\AppData\Roaming\ArduinoCreateAgent
C:\Users\yourname\AppData.arduino-create

If you have installed to a different drive swap the drive letter as needed.
If you also have an unzipped IDE installed that path should also be added to exclusions

I has the same problem,just run as administrator and it will upload the code