使用 Code::Blocks IDE 时禁止(或显示)弹出式控制台

Suppress (or show) popup console when using Code::Blocks IDE

我正在使用 Code::Blocks 版本 13.12 和 GNU GCC 编译器。我最近在 Windows 7 上安装并开始使用这些工具。虽然我不认为语言是一个促成因素,但我使用这个环境来创建 C 和 C++ 应用程序。

在为调试或发布目标可执行文件获得干净的构建并单击绿色 "Run" 或红色 "Debug/Run" 工具栏按钮后,我看到控制台弹出窗口闪烁(出现,然后关闭)即使对于不向 stdout 写入任何内容的代码也是如此。例如...

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

...生成控制台弹出窗口。

任何人都可以描述如何设置 Code::Blocks IDE 来抑制控制台弹出窗口吗?

注意:我已经查看了与此问题相关的答案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与该问题完全无关)

您可以将 Code::Blocks 中的设置更改为 运行 作为 GUI 应用程序。这将告诉它这样编译,并且它不会在启动时产生控制台 window。这就是你这样做的方式:

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.

如果您还有其他问题,这里是收集信息的地方:How to get ride of console box of a GUI program compile by MinGW + Code::Block