Guyz, I have been using codeblocks IDE (Latest Version GCC 4.x) for sometime now. For some weeks now Im facing some problem in it. When I build a program for the first time, it runs smoothly. Then I make changes and I build again, then it gives an error saying "Could not open outputfile: xxx.exe". This error is being given by ld.exe, which I assume is the loader.

And when I tried to delete the exe file it says, permission denied becoz some other program is using it. Even after closing codeblocks I cant delete this file.

This is so annoying. Please help me out. I think the problem is with my OS.

Im running Win 7. Please help me..........

You're using Windows, so use Process Explorer to know which program uses the .exe (In Handle\Find Handle or DLL..., enter the name of the .exe file and you'll get the process that uses the .exe and that prevents you from opening and deleting the file.

If the process can be killed, then kill him.

You can use Task Manager to kill the process. Ctrl+Alt+Del will bring up the task manager.

I tried it. I dont see any process running in the Task Manager.
Thats the problem. THat exe isnt running at all. But still, its behaving as though it is running.

Looks like a process is having a handle on the exe (because the exe isn't running). That's why you may need to find which of the existing processes (with Process Explorer, like I described, or any other tool) has an handle on the exe.

I used unlocker to unlock the file. But it says there is no process using that exe.
But when i select delete option in the unlocker, it says the file cannot be deleted and that it will be deleted on reboot.

I had this problem when I was at the university and a workaround was to restart Code::Blocks. I know it's an ugly workaround, but it may work.

The behaviour looks like a bug. Maybe you can report it on this forum: