Code::Blocks 控制台应用程序不会显示输出
我在 Code::Blocks 中有一个应用程序,它是简单的 Hello, World 传统程序。
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
}
程序构建并执行,但未显示输出。我检查了 Code::Blocks 中的项目属性,它肯定设置为控制台应用程序。对这个问题有什么建议吗?
编辑:输出仅在 IDE 中失败。单独运行时,生成的可执行函数完全符合预期。
I've got an application in Code::Blocks, and it's the simple Hello, World traditional program.
#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?
Edit: The output only fails in the IDE. When run separately the resulting executable functions exactly as expected.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能没有安装
xterm
。如果您使用的是 Linux(Debian 风格),您可以使用包管理器安装它,如下所示:
sudo apt-get install xterm
It's possible that you don't have
xterm
installed it.If you are on Linux (Debian flavor) you can install it with your package manager like so:
sudo apt-get install xterm
也许您需要设置终端来启动控制台应用程序。可以在一般环境设置中完成。
Maybe you need to set the terminal to launch the console applications. It can be done in the general environment settings.
我遇到了这个问题,但在我关闭代码块并重新启动后它就消失了。我也关闭了而不保存对视角的更改(如果这很重要)。重要的是,它发生在我创建一个空项目并尝试将该空项目制作成 C++ 控制台应用程序之后。当这不起作用时,我创建了一个“控制台应用程序”项目(带有 hello world),但它也不会显示控制台。
I had this problem but it went away after I shut code blocks down and restarted. I also shut down without saving changes to the perspective (if that matters). It may be important that it happened right after I made an empty project and tried to make that empty project into a c++ console application. When that didn't work I made a "console application" project (with the hello world) but it wouldn't show the console either.