Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot open output file, permission denied

So I keep getting this error when trying to compile C++ code using CodeBlocks.

cannot open output file [filename.exe] permission denied

It only started today, and it's sporadic and inconsistent. It usually goes away if I shut CodeBlocks down and restart the project, but not always. Sometimes it even goes away when I just press F9 (build & run) several times. I always check Task Manager, but there are never any .EXEs running with my file's name, or anything related to it.

I've also noticed that if this problem occurs and I then try to delete the .EXE manually or otherwise interact with it, Windows tells me I need administrator permission to do so (this is a private PC, and as far as I know I am an administrator on it).

The first time it occurred, the only thing I had added to the code beyond what was in the previous version was a debugging report sent to cout - hardly anything arcane. It sometimes occurs even when no code was changed from a previous version.

What could this be? It's not game-breaking, yet, but it's irritating and I'd rather it didn't get worse.

EDIT: This is old by now, but just in case anyone else is having similar problems, the workaround I currently use is just to consistently delete [filename.exe] before trying to run the code again. This avoids the problem, though it is annoying.

like image 397
GarrickW Avatar asked Jul 29 '11 15:07

GarrickW


People also ask

What does Cannot open output file mean?

If you're are trying to complete a full install, this could indicate that either the DATA folder, or STEAM folder is no longer inside the installation folder, or that the installation folder is incomplete.

Can not open output file access is denied eclipse?

Eclipse C/C++: Cannot open output file *.exe: Permission denied. Solution: It's most likely that your EXE is running and can't be overwritten by the compile process. You have to stop all running processes of your EXE.

Can not open output file 7zip?

Once a user (rightfully) denies internet access, 7-Zip will fail on a few select files ("ERROR: Can not open output file" which doesn't tell you too much), while other files pass extraction. Go to the firewall, allow 7-Zip internet access (even though I don't want to), and it will function again.

Can't open file permission denied Linux?

To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode) command for this purpose.


1 Answers

check that "filename.exe" is not running, I guess you are using Microsoft Windows, in that case you can use either Task Manager or Process Explorer : http://technet.microsoft.com/en-us/sysinternals/bb896653 to kill "filename.exe" before trying to generate it.

like image 95
willll Avatar answered Oct 11 '22 11:10

willll