Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeBlock opens 2 console windows when executing a prog

Tags:

c++

codeblocks

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.

like image 680
Rajesh Bhat Avatar asked Sep 23 '26 01:09

Rajesh Bhat


2 Answers

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.

like image 155
Elmar Avatar answered Sep 25 '26 15:09

Elmar


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 binary folder for project are good way around this issue. For my projects I exclude the entire programming folder where all of my c++ projects and build trees are stored.

like image 21
drescherjm Avatar answered Sep 25 '26 16:09

drescherjm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!