Cannot create temp file: Permission denied issue

Arduino: 1.7.11 (Windows 8.1), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=107011 -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\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\Blink.cpp -o C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\Blink.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\hooks.c.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\WInterrupts.c.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\wiring.c.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\wiring_analog.c.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\wiring_digital.c.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\wiring_pulse.c.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\wiring_shift.c.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\abi.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\CDC.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\HardwareSerial.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\HardwareSerial0.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\HardwareSerial1.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\HardwareSerial2.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\HardwareSerial3.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\HID.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\IPAddress.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\main.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\new.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\Print.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\Stream.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\Tone.cpp.o

Using previously compiled file: C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\USBCore.cpp.o

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=107011 -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:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\WMath.cpp -o C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\WMath.cpp.o

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=107011 -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:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\WString.cpp -o C:\Users\Ritesh\AppData\Local\Temp\build4234064630898819966.tmp\WString.cpp.o

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Cannot create temporary file in C:\Users\Ritesh\AppData\Local\Temp: Permission denied

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ returned 3

Error compiling.

While compiling blink sketch I got this error, what to do??

Usually this means that an existing file is for some reason locked, and the compiler needs to delete it as part of the build process.

You could try restarting your computer and then deleting everything (files and folders) in C:\Users\Ritesh\AppData\Local\Temp.

BTW, do that before starting the IDE.

SAME PROBLEM HERE ... STILL ITS NOT COMPILING AFTER DELETING THE TEMPORARY FILES

problem solved just follow this link FIX-Can Not Create Temp Folder Archive/Invalid temp folder- FIX - YouTube