Eclipse doesnt 'release' .exe after Run

Viewed 60

I am using following Software: Eclipse 20190917-1200, minGW GCG, Windows 10.

I use the "C++ Managed Build" Wizard and select "Hello World C++ Project". Then I build the program pressing CTRL+B and get the following output.

Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\HelloWorld.o" "..\\src\\HelloWorld.cpp" 
g++ -o HelloWorld.exe "src\\HelloWorld.o" 

15:22:23 Build Finished. 0 errors, 0 warnings. (took 1s.262ms)

I am also able to run the HelloWorld.exe in eclipse and see "Hello World" in the console. Everything fine so far.

Then I make a little change in line 14 and replace cout << "Hello World" << endl; // prints Hello World with cout << "Hello World again" << endl; // prints Hello World

and try to build again. This will fail with the following error:

Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\HelloWorld.o" "..\\src\\HelloWorld.cpp" 
g++ -o HelloWorld.exe "src\\HelloWorld.o" 
C:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot open output file HelloWorld.exe: Permission denied
collect2.exe: error: ld returned 1 exit status

15:26:16 Build Failed. 1 errors, 0 warnings. (took 1s.111ms)

So it seems like HelloWorld.exe is still running. However, eclipse says it was terminated. And there is also no process of HelloWorld.exe showing up in the Task Manager.

At first I am unable to delete the "HelloWorld.exe" file in Eclipse or Windows (Permission denied). When I close eclipse the .exe can be deleted and I am able to build again.

So it seems some part of eclipse reads the .exe and prevents me from deleting it but I really have no idea what this could be.

0 Answers
Related