0

When I compile a C-Program with MinGW and I want to remove the exe-file it disappears. But when I hit F5 it is still there. Unlocker can't find any handles and also can't remove it. I can't modify the permissions and can't change the owner. After about 2 minutes the file gets removed. It also appears before the file was executed.

My System: Windows 7 Professional x86. My link line from makefile:

gcc -o main.exe main.o -lopengl32 -lglut32 -lglu32

How to solve this?

das_j
  • 4,444
  • 5
  • 31
  • 47
  • what do you mean it disappears after two minutes? Are you sure that the process isn't running in the background? is your program doing some complex mathematics in a different thread that it is stopping to execute? Please share more information. The question has insufficient information for an answer. – Aniket Inge Oct 19 '12 at 10:10
  • no, it also happens before executing. – das_j Oct 19 '12 at 10:11
  • I suspect virus scanner keeping the file open. – Ben Oct 19 '12 at 10:12
  • no, it also happens without the scanner :( – das_j Oct 19 '12 at 10:14
  • Must be related to your code. Too bad we can not see. – moskito-x Oct 20 '12 at 00:29

2 Answers2

1

A file can be deleted while open, but will not actually be removed from the filesystem until the last handle is closed.

I suspect in your case it is a virus scanner keeping the file open.

EDIT See also:

Apparrently this is a known issue when disabling the "Application Experience Service".

Community
  • 1
  • 1
Ben
  • 34,935
  • 6
  • 74
  • 113
  • Sorry, Unlocker can't find any handles. – das_j Oct 19 '12 at 10:15
  • @das_j, so what? Who says Unlocker knows everything? Try turning off your AV and see if the problem goes away. – Ben Oct 19 '12 at 10:41
  • i think the permissions are modified. in a weird way – das_j Oct 19 '12 at 11:01
  • @das_j, these sorts of problems are almost always caused by virus scanners. Check you don't have two virus scanners - Windows Defender might be installed as well as your other one. – Ben Nov 07 '12 at 10:58
-1

Okay, I still don't know why the permissions are modified, but I found out it also happens with other (e.g. downloaded) .exe files. Solution: Reinstall Windows.

EDIT: Don't know why, but I just had to reenable the Application Expirence Service and it worked. Don't know why....

das_j
  • 4,444
  • 5
  • 31
  • 47
  • The permissions aren't modified. Some software has the file open, probably a virus scanner, but possibly something else, like google desktop search. You may have more than one virus scanner installed, often Windows Defender is installed as well as a regular virus scanner. – Ben Nov 10 '12 at 17:04