Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
667 views
in Technique[技术] by (71.8m points)

c - ld.exe: cannot open output file ... : Permission denied

I recently installed CodeBlocks with mingw32 on Windows 7 Ultimate 32bit in order to dust off my c skills, but this problem has me somewhat stumped.

I decided to fire off a short Fibonacci generator to make sure my setup was working, but I ran into a hurdle.

The program compiles, links and whatnot like a charm and I get a corresponding executable which runs as expected.

The problems occur if I try to compile again, then I get the following:

c:/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot open output file binDebugFibonacci.exe: Permission denied

I can't even edit the permissions of the generated executable.

I've checked the usual suspects:

  • Executable is verily not running.
  • Path to executable is read/writable to mingw32 (otherwise it wouldn't be able to build in the first place)
  • I'm not running cygwin in any shape or form.

And now for the funny bit: Usually after a few minutes, any executables generated by mingw32 which are displaying this Access Denied behaviour will automatically vanish without any intervention from me.

I've googled this somewhat, but most of the other results were either vague or inapplicable.

I wonder whether there is some Windows 7 security setting playing havoc with my .exe's, but I'm not that knowledgeable about Win 7 as to know where to begin searching.

Any one have any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had exactly the same problem right after switching off some (in my opinion unneccessary) Windows services. It turned out that when I switched ON again the "Application Experience" everything resumed working fine.

May be you simply have to turn on this service? To switch ON Application Experience:

  1. Click the Windows start buttonn.

  2. In the box labeled "Search programs and files" type services.msc and click the search button. A new window with title "Services" opens.

  3. Right click on "Application Experience" line and select "Properties" from popup menu.

  4. Change Startup type to "Automatic (delayed start)".

  5. Restart computer.

Application Experiences should prevent the problem in the future.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...