Author Topic: "Cannot open output file"  (Read 49378 times)

Offline lwe1389

  • Single posting newcomer
  • *
  • Posts: 6
"Cannot open output file"
« 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.

Offline lwe1389

  • Single posting newcomer
  • *
  • Posts: 6
Re: "Cannot open output file"
« Reply #1 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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: "Cannot open output file"
« Reply #2 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.

Offline lwe1389

  • Single posting newcomer
  • *
  • Posts: 6
Re: "Cannot open output file"
« Reply #3 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.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: "Cannot open output file"
« Reply #4 on: June 17, 2014, 10:23:17 pm »
probably a directory where you don't have write access? Try in your home directory...

Offline lwe1389

  • Single posting newcomer
  • *
  • Posts: 6
Re: "Cannot open output file"
« Reply #5 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..
« Last Edit: June 18, 2014, 06:25:01 am by lwe1389 »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: "Cannot open output file"
« Reply #6 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

Offline lwe1389

  • Single posting newcomer
  • *
  • Posts: 6
Re: "Cannot open output file"
« Reply #7 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


Offline lwe1389

  • Single posting newcomer
  • *
  • Posts: 6
Re: "Cannot open output file"
« Reply #8 on: June 19, 2014, 07:18:47 pm »
anybody?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline pirx67

  • Multiple posting newcomer
  • *
  • Posts: 40
Re: "Cannot open output file"
« Reply #10 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

Lethamyr

  • Guest
Re: "Cannot open output file"
« Reply #11 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...