I got this error a while ago when compiling a project, and I've gotten it every few days since then, even in different projects, and the only solution that worked is restarting. Some people said to open task manager and close the file, but I couldn't find the file. Some people said to delete main.o in the obj/Debug or obj/Release folder, but they just reappeared when I compile. What else should I try? It's really inconveniencing having to restart every time it pops up.
Asked
Active
Viewed 2,296 times
0
-
Disable your antivirus and test again. – drescherjm Jul 28 '17 at 00:54
-
@drescherjm I don't have antivirus – Merle Jul 28 '17 at 00:58
-
Make sure the program is not still running from the last build. – drescherjm Jul 28 '17 at 01:04
-
1Does filename.exe exist? If so, can you delete it? If you can't delete it, we need to find who has the file locked. SysInternals Process explorer may help here. Main menu->Find->Find Handle or DLL and type in the name. – user4581301 Jul 28 '17 at 01:04
-
I assume that's the problem, but how do I make sure? – Merle Jul 28 '17 at 01:05
-
@user4581301 gave pretty good advice on that. – drescherjm Jul 28 '17 at 01:06
-
***where's filename.exe?*** Only you can answer that.. You have to know where your compiler is creating files... – drescherjm Jul 28 '17 at 01:06
-
@drescherjm oops, yeah it exists. I can't delete it though. – Merle Jul 28 '17 at 01:07
-
***I can't delete it though.*** Then it seems to be an OS issue. For some reason the filename.exe is already open. – drescherjm Jul 28 '17 at 01:07
-
@user4581301 "Error opening process: the handle is invalid." – Merle Jul 28 '17 at 01:11
-
Error opening what process? Process Explorer? – user4581301 Jul 28 '17 at 01:13
-
Do you use VirtualMachine? or **filename.exe** is using on VirtualMachine? – Bryant Jul 28 '17 at 01:14
-
@user4581301 That's the error that shows up when I try closing filename.exe in process explorer – Merle Jul 28 '17 at 01:14
-
@Bryant No, I don't use a virtual machine. – Merle Jul 28 '17 at 01:15
-
@Merle. Windows Defender should be set to "Disable". Please pot state of your project options. – Bryant Jul 28 '17 at 01:22
-
If you ran it, you should be able to kill it, but run Process Explorer as an Administrator if you can and see what happens when you try to kill it. If you can't, double-click the process to get the process status dialog and check out the Image tab. Find out who the Parent is. – user4581301 Jul 28 '17 at 01:23
2 Answers
0
- check where you put the project maybe is in a file you have no access to it
- run Code::Blocks as admin
- make sure the program is not still running go to task manager and kill it
-
I have access to the file, it's a new project. I also tried running as administrator, which didn't work either. – Merle Jul 28 '17 at 00:40
-
then I guess you will need to reinstall everything I know codeblocks is buggy that's why I switched to Visual Studio downloading all windows header files is hard its not just windows.h so two options re install everything or reinstall another copy of codeblocks take its minGW files and put it in your codeblocks ide – Jul 28 '17 at 00:43
-
I think there's a simpler solution than getting rid of everything, I've seen a ton of people get past this problem, it's just that none of the solutions worked for me. – Merle Jul 28 '17 at 00:54
-
the one that will work for sure is to find the file mingw that codeblocks has copy its contents and put them in your codeblocks mingw file I guarantee 100% working – Jul 28 '17 at 00:59
-
The mingw file that codeblocks has is already in the codeblocks mingw file – Merle Jul 28 '17 at 01:03
-
-
there most be a better way but that's all I have for now maybe some more info like where the file is what codeblocks do you have is it the nonsetup version? is the file on the desktop file...etc may help – Jul 28 '17 at 01:08
-
possible duplicate of this https://stackoverflow.com/questions/6875403/cannot-open-output-file-permission-denied – Jul 28 '17 at 01:12
0
Don't just look under which programs are running
- Check the processes list (Background Processes)and see if you can find a process running by the same name as your file.
- Right click the process name
- Choose end task. See if that works. It seems to have worked for me.

Troy
- 101
- 9