Code::Blocks Forums

User forums => Help => Topic started by: lwe1389 on June 17, 2014, 07:18:17 pm

Title: "Cannot open output file"
Post by: lwe1389 on June 17, 2014, 07:18:17 pm
I know there are countless threads about this, though I assure you I've sifted through each of them and not found any answers to my problem.

Cannot open output file bin\debug\First Project.exe Permission Denied

I get this build error message ONLY after I've built once, (the first time always works) and then changed something. The next time I try to build I get that message.

is the message I'm getting. I've reinstalled codeblocks AND my moved my project folder multiple times, I've changed permissions, messed with user account controls, made Ld.exe in the codeblocks folder run as an administrator, checked in task manager and sysinternals for a double process of my code, etc.

None of these have worked, so if any of you have any ideas I'd love to hear them.
Title: Re: "Cannot open output file"
Post by: lwe1389 on June 17, 2014, 07:37:03 pm
Update:

With task manager and sysinternals up, there are no conhost processes running when I am getting this error, there are also no "firstproject.exe" or whatever, BUT after about 5 minutes (5 long minutes) I am able to build again... It's acting as though it's taking a minute to close the process down but there is indeed none running.

Strange
Title: Re: "Cannot open output file"
Post by: jens on June 17, 2014, 08:21:47 pm
You did not really tell much about your installation.
I assume it is windows (exename and name of the tools).

This might be some stupid security software that kicks in and blocks the exe.
Title: Re: "Cannot open output file"
Post by: lwe1389 on June 17, 2014, 08:52:11 pm


You did not really tell much about your installation.
I assume it is windows (exename and name of the tools).

This might be some stupid security software that kicks in and blocks the exe.

Windows 7 professional
64 bit


I've killed all antivirus and security exes in the task manager, and AVG is completely uninstalled (downloaded a clean AVG completely tool)

Still no luck.
Title: Re: "Cannot open output file"
Post by: BlueHazzard on June 17, 2014, 10:23:17 pm
probably a directory where you don't have write access? Try in your home directory...
Title: Re: "Cannot open output file"
Post by: lwe1389 on June 17, 2014, 11:14:38 pm
Update

It seems to work 75% of the time if I keep sysinternals process explorer up and directly kill the process each time before I hit any key to end


What a pain..
Title: Re: "Cannot open output file"
Post by: BlueHazzard on June 18, 2014, 07:25:23 pm
this is 300% a user problem... I have two things in mind:
1) Are you sure that you don't have any antivir, adaware, firewall or windows security installed what can block the access to your program?
2) Are you sure, that it is not a coding error, probably your application  crashes or hangs. (is there a drwat*.exe in the process tree?)

and directly kill the process each time before I hit any key to end
this screams for a coding error (deleting or not deleting a pointer...). Have you tried to debug your code?

greetings
Title: Re: "Cannot open output file"
Post by: lwe1389 on June 18, 2014, 10:49:52 pm
It isn't a coding error, i'm following c + + primer, buckys tutorials, and a few other resources. A majority of the code is copy and paste or nearly identical to the sources aforementioned. It's day 3 of self learning and i'm only just starting to write my own (which obviously have mistakes at first) but the problem has persisted since the second I installed codeblocks. (if I change "hello world" to "hello Lance", it happens"

I'll look deeper into security software but I don't know if that's it

Title: Re: "Cannot open output file"
Post by: lwe1389 on June 19, 2014, 07:18:47 pm
anybody?
Title: Re: "Cannot open output file"
Post by: stahta01 on June 19, 2014, 07:22:37 pm
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Title: Re: "Cannot open output file"
Post by: pirx67 on June 20, 2014, 12:10:59 am
Well, I'll post a conjecture.

You can't write to the binary file of a program as long as the program is running, even as administrator. You've already suspected something like that.
I remember that one of the tools of the "Sysinternals Suite" could observe and log if a file has been opened by a process and if it is still open. Perhaps it is
the "Process Monitor". I don't remember exactly and I don't have a Windows System at hand now to check it.

Try to find out which process keeps your "First Example.exe" open and you should be one step towards a solution.

In spite of that turning on full compiler logging and posting the output should also do no harm  ;D

You may grab the "Sysinternals Suite" from here: http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx
Title: Re: "Cannot open output file"
Post by: Lethamyr on May 12, 2021, 09:55:21 am
You can Crtl+C your script and then, make a same project with the same title in the same file. That way, most of the times, you will get rid of your error and not erase the code, but sometimes, the code could be turned into the preview(code that is always made), so you would need to Ctrl+C it.
Please understand if my English is bad. I'm a Korean...