Author Topic: windows 7 "permission denied" problem  (Read 136628 times)

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
windows 7 "permission denied" problem
« on: July 26, 2011, 09:43:55 pm »
when i compile any program it executes 2 or 3 times fine but after that C::B gives me error when i compile it again it gives me error....

ld.exe||cannot open output file C:\Users\username\Documents\Codeblocks\del it .exe Permission denied

and when i restart C::B then it works fine but again after compiling program 1 or 2 time again it says "permission denied".

i am facing this problem from past few days.

more info:-
OS - window 7 ultimate
C::B - SVN 7075
status - i don't have girlfriend  :(

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: windows 7 "permission denied" problem
« Reply #1 on: July 26, 2011, 09:55:34 pm »
i am facing this problem from past few days.
This sounds to me like either a non-stopping application (i.e. it remains in memory after closing) or an issue with an AntiVirus (/defense) software that does not free it's handle to the executable.

You can try:
- inspect the running processes in your task manager to see if the app closed properly
- disable your AV / defense software temporarily, see if the problem is gone
- use a tool like process explorer (from sysinternals), search for the handle of your application and see which (other) process gained a handle to it

Note that this is 99.9% not an issue with Code::Blocks, but with the system.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #2 on: July 26, 2011, 10:27:59 pm »
i tried first two methods i turned my antivirus off and also checked process list but i found nothing.

but i noticed that after executing the program and after when i get permission denied error when i wait 1 or 2 minutes i can execute it again without any error.

i will try process explorer. may be i am missing something :? .

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: windows 7 "permission denied" problem
« Reply #3 on: July 26, 2011, 10:32:59 pm »
it could also be a loop running in your program. just because you pushed that x to close it doesn't mean your app kills it's self mid process.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: windows 7 "permission denied" problem
« Reply #4 on: July 27, 2011, 07:10:17 am »
it could also be a loop running in your program. just because you pushed that x to close it doesn't mean your app kills it's self mid process.
Yes, but then it should appear in the task manager which isn't the case:
- inspect the running processes in your task manager to see if the app closed properly
i tried first two methods i turned my antivirus off and also checked process list but i found nothing.
« Last Edit: July 27, 2011, 07:12:07 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

zabzonk

  • Guest
Re: windows 7 "permission denied" problem
« Reply #5 on: July 27, 2011, 09:22:56 am »
I've had exactly the same problem. It happened when I switched firewall implementations and I only solved it by expunging all traces of both firewalls and then reinstalling one from scratch. So I would look again at it being a problem with your AV/firewall software. In any case, I doubt it is a CB problem - I bet you will get the same thing happening when you compile from the command line.
« Last Edit: July 27, 2011, 09:25:17 am by Neil Butterworth »

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #6 on: July 27, 2011, 04:00:46 pm »
anyone help please this is killing me still getting those "permission denied" errors.

any idea any way i can code properly without this errors it's slowing me down a lot and forcing me to try something else(which i don't want).

zabzonk

  • Guest
Re: windows 7 "permission denied" problem
« Reply #7 on: July 27, 2011, 04:37:02 pm »
Have you tried compiling from the command line? Do you get the same errors? If so, it isn't a CB problem and you should look elsewhere for a solution.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: windows 7 "permission denied" problem
« Reply #8 on: July 27, 2011, 04:51:31 pm »
anyone help please this is killing me still getting those "permission denied" errors.

any idea any way i can code properly without this errors it's slowing me down a lot and forcing me to try something else(which i don't want).
All I can tell is that this is certainly not a C::B issue. Why that happens extremely depends on your system and used software. It is uncertain that you can get an any more help from the Code::Blocks community therefore.

Sorry.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #9 on: July 27, 2011, 05:21:58 pm »
anyone help please this is killing me still getting those "permission denied" errors.

any idea any way i can code properly without this errors it's slowing me down a lot and forcing me to try something else(which i don't want).
All I can tell is that this is certainly not a C::B issue. Why that happens extremely depends on your system and used software. It is uncertain that you can get an any more help from the Code::Blocks community therefore.

Sorry.

ok
BTW thanks everyone for suggestions.

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #10 on: August 31, 2011, 09:00:25 pm »
i asked on windows forums but they are saying that....
"you should ask this question form codeblocks devs"

so i am back here repeating the same question again (i hope i will get some help this time).

and here is the prof of my problem.

http://www.youtube.com/watch?v=Q7_0GG1qLJg

please turn the annotations on and watch in HD.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: windows 7 "permission denied" problem
« Reply #11 on: August 31, 2011, 09:59:02 pm »
You can try to rename the exe to delit.exe, not del it.exe.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #12 on: August 31, 2011, 10:26:53 pm »
You can try to rename the exe to delit.exe, not del it.exe.

that doesn't work.  :?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7699
    • My Best Post
Re: windows 7 "permission denied" problem
« Reply #13 on: September 01, 2011, 01:10:09 am »
Have you tried compiling from the command line? Do you get the same errors? If so, it isn't a CB problem and you should look elsewhere for a solution.
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 websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #14 on: September 01, 2011, 05:24:12 pm »
ok problem is solved when i reinstalled the codeblocks it's now working fine.

i thing that access denied problem was because i mixed the nightly build with the original codeblocks program files (i am stupid  :roll:).

anyway case is closed.

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #15 on: September 02, 2011, 06:38:26 pm »
ok case is not closed i am getting those error again i don't know why :shock: :shock: :shock:.

it was working fine tomorrow and now i am back where i was before :x :x  :x


zabzonk

  • Guest
Re: windows 7 "permission denied" problem
« Reply #16 on: September 02, 2011, 07:14:30 pm »
> ok case is not closed i am getting those error again

You still haven't said whether or not  you get the same errors when you compile from the command line. Until you clarify this, I can't see you getting much help here.

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #17 on: September 03, 2011, 05:50:57 pm »
ok i never tried compiling using command line so can any one tell me how to do it (small syntax example will be fine).



Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: windows 7 "permission denied" problem
« Reply #18 on: September 03, 2011, 06:31:36 pm »
First ensure mingw\bin is in your path
path C:\mingw\bin;%path%

Compile and link in single step
g++ myFile1.cpp myFile2.cpp -o outputExecutable

Compile, then link
g++ -c myFile1.cpp myFile2.cpp
g++ myFile1.o myFile2.o -o outputExecutable


Use flags
g++ -Wall -DmyDefine -IC:\my\include\path -c myFile1.cpp myFile2.cpp
g++ -LC:\my\library\path -lmyLibrary myFile1.o myFile2.o -o outputExecutable


To see exactly how your program is built, goto Settings->Compiler and debugger...->Build options (tab) and check Save build log and Always output the full command line.  Code::Blocks will now tell you exactly what it is sending the compiler (it might say mingw32-g++.exe, but that is essentially the same as g++).

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #19 on: September 04, 2011, 05:44:09 pm »
so i tried to compile my file main.cpp which is on my G drive i typed this on command line.

Code
G:\g++ main.cpp -o main.exe

but there was no output file on the drive there was only one file main.cpp and nothing else on my G drive.

am i doing something wrong?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: windows 7 "permission denied" problem
« Reply #20 on: September 04, 2011, 06:26:05 pm »
Were there any warnings in the command prompt window?

Code
'g++' is not recognized as an internal or external command,
operable program or batch file.
Means that your compiler is not on the path.
First ensure mingw\bin is in your path
path C:\mingw\bin;%path%
I forgot to mention that C:\mingw\bin must (of course) point to your compiler's installation directory; on my computer, for example, it is C:\libraries\mingw, so I would type
path C:\libraries\mingw\bin;%path%

Code
g++: main.cpp: No such file or directory
Means that you are in the wrong folder; type
G:
to switch to the G: drive, and
cd \
to ensure you are in the root of the drive.  Then your type
g++ main.cpp -o main.exe
to compile.  The resulting line should look like
Code
G:\>g++ main.cpp -o main.exe
If there are no errors, it will produce main.exe (but it will not show any messages).

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #21 on: September 04, 2011, 07:57:24 pm »
on my computer mingw is installed on "C:\Program files\Codeblocks\Mingw"
i included it on my path successfully ( i know about DOS commands a bit).

(i found no difference on use of g++ of linux terminal and mingw's g++ btw i am not too familiar with g++)

there was no error using g++ it was just showing tons of messages but no output windows executable file or object file.

i am feeling that permission denied thing is mingw's problem because when i get the access denied error it show something is wrong about ld.exe which is a mingw file(i found that on mingw directory.)




 
« Last Edit: September 04, 2011, 08:08:16 pm by websnake »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: windows 7 "permission denied" problem
« Reply #22 on: September 04, 2011, 08:18:12 pm »
there was no error using g++ it was just showing tons of messages but no output windows executable file or object file.
If you compile on the commandline, and the file does not have any errors, there should not be any messages.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: windows 7 "permission denied" problem
« Reply #23 on: September 04, 2011, 08:28:52 pm »
If there is a mingw problem, I am not sure what can be done (except perhaps install a new version if you have not - like the unofficial TDM).  One other thing I can think of is that one of your project's settings may be wrong.
(ld.exe is the linker back-end that g++ calls.)

Your could post the command-line log here.

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #24 on: September 04, 2011, 09:21:04 pm »
so now i found there was a output file but it just disappered in few sec windows was not giving me any access to that file.

http://www.youtube.com/watch?v=rTJdvZOaOBY


thats why i can't see main.exe on that drive so finally it looks like it's a Mingw problem so anyone have any suggestions for that (any mingw
alternatives or anything else which will take place of mingw or a solution of the problem i am facing).

if i have wrong compiler and debugger settings then how can i resolve it?
« Last Edit: September 04, 2011, 09:33:50 pm by websnake »

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: windows 7 "permission denied" problem
« Reply #25 on: September 04, 2011, 10:41:11 pm »
It seems you are using cygwin, not mingw?!  Not only that, but if I am reading correctly, it is a six year old version of gcc.  Since you did find the mingw folder in your Code::Blocks installation, I assume that it has been installed as well, but that cygwin resides somewhere else on your hard-drive (possibly the root of the C: drive), and is interfering.  I would highly recommend purging your computer of all compilers, then installing the TDM build mingw (the official version should be fine as well if you want).

To get a log of those errors, you can enter
g++ main.cpp -o main.exe > log.txt

Also, it is possible that some previous installation has left something in your path environment.  Look at/post the results of
path > pathLog.txt

I think a rogue cygwin installation is the cause of your problems.  (If I remember correctly, cygwin has some problems about requiring to be run as administrator, so that could explain the "permission denied" problems.)

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #26 on: September 05, 2011, 08:24:16 pm »
so thats the problem i installed cygwin for PSP development.

ok i can remove it i don't use it much now so how can i completely uninstall cygwin(maybe i should use google for this question).
if any one can tell me where i can find a tutorial about uninstalling it that would be really help full.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513

Offline websnake

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: windows 7 "permission denied" problem
« Reply #28 on: September 06, 2011, 05:26:46 am »
thanks.
« Last Edit: September 06, 2011, 05:50:25 am by websnake »

Offline timojaask

  • Single posting newcomer
  • *
  • Posts: 4
Re: windows 7 "permission denied" problem
« Reply #29 on: November 01, 2011, 09:12:14 am »
I am having exactly the same problem, but it cannot be C::B or mingw, because I have the same problem in C::B, in Dev-C++ and in SharpDevelop (msbuild.exe for C# compiling). Deleting executable by hand from Explorer works when compiling in C#, but executables compiled with mingw cannot be deleted even manually. It says I need Administrator permissions, but I am the administrator. Executables compiled with mingw disappear after a couple of minutes after I try to delete them. I am running Windows 7 x64.

The problem occurs even if I don't run the compiled executable.
Turning off AV doesn't help either.
I was trying to search for the name of the executable in Process Explorer, but it doesn't return any results.


This is among the most annoying things I have had in my programming experience. Working on a project 8 hours / day, while compiler fails to write the executable is so damn frustrating.

zabzonk

  • Guest
Re: windows 7 "permission denied" problem
« Reply #30 on: November 01, 2011, 09:17:31 am »
I had this, and as you say it is definitely not a CB problem. I tracked my problems down to a ropey firewall (not AV) installation - completely deleting all firewall software and then re-installing the firewall fixed it for me.

really_specific

  • Guest
Re: windows 7 "permission denied" problem
« Reply #31 on: December 21, 2011, 03:59:55 pm »
I had run into the same problem, and was searching Google for a solution when I stumbled upon this site. I tried following some of the solutions here, but I suppose they weren't for me (This is not to say, however, that any of these other solutions shouldn't be tried).

I managed to fix this problem in what I guess was a simple but unorthodox way. I figured out that the root of the problem was coming from when C::B makes a folder for the project and its files wherever you want it to. For some reason, the folders which C::B makes are automatically locked, for lack of a better word (this happens on my computer at least). So, I wanted to repeat the actual project-making process and delete the locked file.

/*
Before I go on any further, I just wanted to clarify this; I was unable to access the project folder form Windows Explorer, nor was I able to change the permissions of the folder when I accessed it via one of C::B's browsing utilities.
*/

Since C::B can apparently open and access the file just fine (and thus can open/delete/rename it), I deleted the file from where I had C::B create it; however, after I sent it to the Recycle Bin, I wanted to check something first before I tried to make a whole new project. Since all I essentially did was just move the folder which contained the project from one place to another, I wanted to see if I could see the folder in Recycle Bin. As it turned out, when I opened Recycle Bin and looked for the folder, there it was; I was able to open it and see it just fine. Intrigued, I restored the folder to see if it retained this state.

To my luck, it did. I was now able to open and edit and do whatever I wanted to the project folder, even from Windows Explorer. I opened the project file in C::B and tried to build it, and it worked! I tried building multiple times with success, and tried changing something and building it again, with success. I thought I would share this with you all to help anyone else who had this problem and also to let the experts on C::B examine this to determine whether or not it was truly a success.

Regardless of whatever, have a good day!

lucj

  • Guest
Re: windows 7 "permission denied" problem
« Reply #32 on: November 15, 2012, 05:45:59 pm »
Found this pearl here : http://stackoverflow.com/questions/7655471/ld-exe-cannot-open-output-file-permission-denied#answer-7904469 which solved this most annoying problem for me (windows 7, executable not removable but not running either, looking like some kind of phantom-permissions problem).

This post suggests to reactivate a windows service called "Application Experience"

Offline Rookie

  • Single posting newcomer
  • *
  • Posts: 2
Re: windows 7 "permission denied" problem
« Reply #33 on: November 16, 2012, 03:32:09 pm »
This may be helpful...

I have been pulling my hair out for days over the "Permission Denied". I have eliminated all the usual suspects: Windows Experience, Windows Search, Folder/File Permissions, UAC...

This was the behaviour I was getting compiling Code::Blocks-wx2.8.x:

* Several of the low-level projects were built (exchndl, tinyXML etc), and the output folder was filling up with objects (thus ruling out most of the usual suspects above).
* When CB hit wxpropgrid, wxpropgrid.dll made a brief appearance in the output folder and then vanished! Ultimately, CB gave the "Permission Denied" message.
* Procmon (SysInternals) showed that ld.exe has created and then deleted the dll! As the file briefly appeared, it was not a proper permission denied.
* collect2.exe then failed to find the dll resulting in the extremely frustrating "Permission Denied".

This shows that ld.exe is not happy about something and deleting the output, causing the rest of the process to trip over itself!
Manually running the command line showed some extraneous folders, and I finally traced the problem:

In:
Project -> Build Options... -> wxpropgrid (fill in your problem project here) -> Linker Settings -> Link Libraries

I had inadvertently listed a directory, not a file!!! I had meant to add the folder to the linker search list!

Now the error makes sense: ld.exe could not find the library (since it was a folder), but unfortunately emitted "Permission Denied" instead of "Library ... not found"

Suggestion to CB: Check that files are files (and paths are paths) in the settings dialogs - I am sure this will save a massive amount of frustration!

The moment I fixed this, voila! everything compiled perfectly!

PS: This is not a CB problem (as has been pointed out numerous times), nor is it a Windows problem (my favourite suspect). But, CB helps you shoot your foot off by not telling you that your entry to a dialog is not a file.

Frederick1337

  • Guest
Re: windows 7 "permission denied" problem
« Reply #34 on: January 23, 2015, 12:49:34 am »
ok problem is solved when i reinstalled the codeblocks it's now working fine.

i thing that access denied problem was because i mixed the nightly build with the original codeblocks program files (i am stupid  :roll:).

anyway case is closed.

Thank you so much! I was having this same exact problem. Solved for me too! lol ;D