问题
I have recently installed Code Blocks and I'm using it for C++ programming.
I have written a basic Hello World program and when i run the program, 2 console windows are opening instead of 1. If there's only output then the 1st console closes after showing the output and then the 2nd window stays open. My main problem is when I'm trying to take in some input and execute some more stuff. The 1st window works as it should, going to the end of the prog, closes and then the 2nd window again starts from the beginning.
I'm not able to close the 1st window and it's kinda irritating running through the program twice. I tried searching on the net, but no one seems to have faced this issue before.
Any advice is really appriciated.
回答1:
This problem can be caused by an antivirus application like avast that executes unknown applications for a short time in a sandbox to determine if the program appears to be a virus. Disabling this feature altogether or excluding your visual studio project folders are good way around this issue.
回答2:
If you're running Avast, go to :
- Settings -> Active Protection -> File System Shield [settings icon] -> Exclusions.
- Press [Add]
- and enter the following: " * /folder/* " where folder is the name of your project folder (no spaces).
Should run fine now.
来源:https://stackoverflow.com/questions/25609125/codeblock-opens-2-console-windows-when-executing-a-prog