Compiler problem

Hello,
from one day to the other I have a problem to compile a sketch: at the end of the compiling process the following error message occurs:
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-ar: unable to rename 'C:\Users\Ernst\AppData\Local\Temp\build2784888612357824183.tmp/core.a'; reason: Permission denied

I checked all directories with respect to privileges and found that the directory C:\Users\Ernst\AppData\Local\Temp\build2784888612357824183.tmp
is marked as "readonly".
I removed that mark, but after another compilation attempt it is marked again as "readonly".
Apparently any of the programs called by the compiler sets that marking. Has anyone a comment on that problem?

Disable anitvirus/spyware.

hello CADLINK,
you were right: as soon as I deactivated Antivirus the compilation completed. Thanks for the hint!
wuidakaiser

Better than disable is to add the following to the white list / exclusions.
Much safer.

Slow compiles under Windows
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