Search code examples
codeblocks

Suppress popup console in apps created using Code::Blocks IDE


I am using Code::Blocks version 13.12 with the GNU GCC Compiler. I recently installed and started using these tools on Windows 7. Although I do not believe language is a contributing factor, I use this environment to create both C and C++ applications.

After getting a clean build for either a debug or release target executable, and click on either the green "Run" or the red "Debug/Run" toolbar button, I see a console popup flicker (appear, then close) even for code that writes nothing to stdout. For example...

int main(void)
{
    int a = 1;
    return 0;
}

...produces a console popup.

Can anyone describe how to set the Code::Blocks IDE to suppress the console popup?

Note: I have reviewed answers related to this question here and here. These posts are related in that one is closed as a duplicate of the other, but answers for neither address this question. (i.e. Because my systems do not use Avast, Avast is completely unrelated to the issue)


Solution

  • You can change the settings in Code::Blocks to run as a GUI application. This will tell it to compile as such and it will not produce a console window on startup. And this is how you do so:

    1. Click Project on the CodeBlocks menu.  
    2. Click Properties.  
    3. Click the second tab, Build Targets.  
    4. On the right, where it says Type: Console application, change it to GUI application.  
    5. Rebuild the project.
    

    This is where the information was gather if you have further questions: How to get ride of console box of a GUI program compile by MinGW + Code::Block