Arduino Exit 1 compile Error permission denied

Hey guys!
So I recently bought an Arduino Uno from Ebay. But when I plugged it into my PC, after downloading the Arduino Program for my Windows 10 PC, I wanted to play around with my new Arduino. So as a beginner I opened up an Arduino project from the Internet for my LED Strip. Then I got an error message (see below).
I thought maybe the project has an error and I tried out one of the examples. The same error occurred. Then I opened a few other examples (not at the same time of course) and got the same error message in each of them (see below).
So I got really frustrated and started googling. But nothing I found helped. I tried:

-reinstalling
-deleting the “Arduino15” folder
-opening Arduino as an Administrator
-deleting every Arduino folder I could possibly find, restarting the PC and installing the Arduino Programm again…

BUT NOTHING WORKED!!! >:(

So I decided to ask u guys for help! Any help is apreciated.

Error Message:

Arduino: 1.8.4 (Windows 10), Board: “Arduino/Genuino Uno”

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Jonas\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10804 -build-path C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641 -warnings=none -build-cache C:\Users\Jonas\AppData\Local\Temp\arduino_cache_277291 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Jonas\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10804 -build-path C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641 -warnings=none -build-cache C:\Users\Jonas\AppData\Local\Temp\arduino_cache_277291 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
Using board ‘uno’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\sketch\Blink.ino.cpp” -o “nul”
Generating function prototypes…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\sketch\Blink.ino.cpp” -o “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\preproc\ctags_target_for_gcc_minus_e.cpp”
“C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags” -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\preproc\ctags_target_for_gcc_minus_e.cpp”
Compiling sketch…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\sketch\Blink.ino.cpp” -o “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\sketch\Blink.ino.cpp.o”
Compiling libraries…
Compiling core…
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\wiring_pulse.S.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\WInterrupts.c.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\hooks.c.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\wiring.c.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\wiring_analog.c.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\wiring_digital.c.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\wiring_pulse.c.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\wiring_shift.c.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\CDC.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\HardwareSerial.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\HardwareSerial0.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\HardwareSerial1.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\HardwareSerial2.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\HardwareSerial3.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\IPAddress.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\PluggableUSB.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\Print.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\Stream.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\Tone.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\USBCore.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\WMath.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\WString.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\abi.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\main.cpp.o
Using previously compiled file: C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\new.cpp.o
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc-ar” rcs “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\core.a” “C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\wiring_pulse.S.o”

c:\program files (x86)\arduino\hardware\tools\avr\bin…/lib/gcc/avr/4.9.2/…/…/…/…/avr/bin/ar.exe: unable to rename ‘C:\Users\Jonas\AppData\Local\Temp\arduino_build_765641\core\core.a’; reason: Permission denied

exit status 1
Error compiling for board Arduino/Genuino Uno.

Thanks for the help, Jonas!

So its windows 10 and a “permissions” error.

This is usually a user level problem.
Running the IDE as a FULL administrator can often fix that. (that is above a user with just admin rights)

Also Antivirus and over aggressive security could cause these types of issue.

Network Shares and shared computers are another culprit.

Rule those out first.

Also next time you post any error messages please use the code tags ( </> ) as the forum has a bad habit of crunching some text into other characters especially on sketches.

The IDE should not need to be run as admin. If running the IDE as admin fixes it, that implies that the permissions of a folder used in the build process are incorrect...

The core.a issue is usually an overaggressive antivirus program interfering.

I would agree that users should not need to elevate privileges but it has been shown to work in similar questions.
It is also a fix that has worked for the CREATE platform too as far as LINUX, MAC, and WIN platforms are concerned.

Thats why I included it as a probable issue.

Eventually after setting permissions on folders, reloading the application etc. I found that when the IDE downloads a library item it puts it in the libraries folder within the sketch folder, If you then move the library item to the libraries folder within Program Files(x86)\Arduino\Libraries\ it works

So, just to be a little bit more detailed.

For me, there is an Arduino folder, which contains a folder named for my sketch, and a folder named libraries. In that folder are two more folders, SD and Adafruit_Circuit_playground. Those folders already exist (for me) in C:Program Files (x86)Arduinolibraries.

Not wishing to break some irreparably, I just renamed the folder libraries to libraries_SAVED. That way, if this stunt doesn't work, I can change the name back.

When I ran the verify/compile step, I got a new problem. First of all, the compiler created a new libraries folder in my arduino folder. That folder contains a readme.txt file which says:

For information on installing libraries, see: [url=http://www.arduino.cc/en/Guide/Libraries]http://www.arduino.cc/en/Guide/Libraries[/url]

The run also died with the error message: avr-gcc: fatal error: could not open temporary response file C:UsersjeffsAppDataLocalTempccsOQc3d . I used the file explorer and created a folder ccsOQ3cd (The name of your folder might be different).

At that point, I got another error: c:/program files/windowsapps/arduinollc.arduinoide_1.8.39.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'
. I found an answer at Compiling error - undefined reference to 'main' - Programming Questions - Arduino Forum copy the text to a new sketch. I tried that, and I got a problem creating a folder in
C:UsersjeffsAppDataLocalTempcc6fHE6a.s
.

I'm a Linux guru, and I am working on Windows/10. The subtleties of Windows/10 file security escapes me. So I did what I always do when I have unexplained problems with Windows: I rebooted. That cleared the problem.