If I compile Test.cpp with g++ -o Hello_World Test.cpp, I get Hello_World.exe. If I run g++ -o Hello_World Test.cpp again, I get a collect 2 error:
The goal is to compile Test.cpp into Hello_World.exe (but two times in a row). Here are my steps:
- In a terminal:
g++ -o Hello_World Test.cpp
- This will successfully create
Hello_World.cpp
- Test with
./Hello_World.cpp
- The program did compile
- I also tried this without this step and had the same error later
- Compile again:
g++ -o Hello_World Test.cpp
- This is where the collect 2 error occurs, preventing the file from being compiled.
- If I right click on
Hello_World.cppand try to delete it, I get an error sayingThe action cannot be completed because the file is open in another program. I tried to useresmon.exeto see the running.exefiles, and I couldn't figure out what was usingHello_World.exe, andHello_World.exewas not open itself. If I userm Hello_World.cpp, I get an error saying I don't have permission.
If anyone has an idea as to what might be happening, I would greatly appreciate it.

Well it’s simple. The application is running in the background. You can check your TaskManager and kill it from there.
What exactly causes the application to keep running in the background will need more investigation to find out.
The most common reason this happens in Sublime is when you are running an interactive application. Sublime doesn’t forward any input that you type into the output panel to your running program, so it’s effectively hung forever in the background waiting for input you can’t provide.