C++ Code::Blocks 控制台应用程序不会显示输出

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7554836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 17:06:50  来源:igfitidea点击:

Code::Blocks console app won't show output

c++codeblocks

提问by Puppy

I've got an application in Code::Blocks, and it's the simple Hello, World traditional program.

我在 Code::Blocks 中有一个应用程序,它是简单的 Hello, World 传统程序。

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
}

The program builds and executes, but the output isn't shown. I checked the project properties in Code::Blocks and it is definitely set to console application. Any suggestions as to the problem?

程序构建并执行,但未显示输出。我检查了 Code::Blocks 中的项目属性,它肯定设置为控制台应用程序。对问题有什么建议吗?

Edit: The output only fails in the IDE. When run separately the resulting executable functions exactly as expected.

编辑:输出仅在 IDE 中失败。当单独运行时,生成的可执行文件完全按预期运行。

回答by Kamil Szot

It's possible that you don't have xterminstalled it.

可能是你没有xterm安装。

If you are on Linux (Debian flavor) you can install it with your package manager like so:

如果您使用的是 Linux(Debian 风格),您可以使用您的包管理器安装它,如下所示:

sudo apt-get install xterm

sudo apt-get install xterm

回答by amkrous

Maybe you need to set the terminal to lunch the console applications. It can be done in the general environment settings.

也许您需要设置终端来运行控制台应用程序。它可以在一般环境设置中完成。