问题
Now and then I get this compilation error when compiling a c-file in Eclipse.
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot open output file main.exe: Permission denied
It happends when I have made a change in the source-code - but not always.
I know how to solve this* but I would like to know WHY it occurs and how to avoid it?
*In eclipse I go to the debugger and terminate the main thread of the program
回答1:
You said it yourself, it happens because the program being compiled is still running.
In Windows, you can't make changes to the exe file of a program when it's running.
It's fantastically annoying, and one of those things that (to me) make Windows slightly less comfortable than e.g. Linux for development.
来源:https://stackoverflow.com/questions/19855571/permission-denied-cannot-open-outputfile