(Since ahoffer the deleted answer is not entirely correct, I will post it based on the information in the comments.)
On Windows, gcc by default creates an executable file called a.exe . (On UNIX-like systems, the default is a.out by default.) You usually specify a name with the -o option.
Apparently, the generated a.exe file generates a false positive match in your antivirus software, so the file is automatically deleted shortly after its creation. I see that you have already contacted the Avast developers about this false positive.
Please note that antivirus programs usually check the contents of the file and not its name, therefore, generating a file with a name other than a.exe will not help. However, making some changes to the program may change the contents of the executable file to avoid the problem.
You can try creating a simple hello world program to see if the same thing happens.
Thanks to Chrono Kitsune for linking to this relevant Mingw-users discussion in a comment.
This does not apply to your problem, but you should print a new line ( '\n' ) at the end of your program output. This probably doesn't matter much in your Windows environment, but in general, standard program output should (almost) always have a newline at the end of the last line.
source share