没有 "hello world " 输出 (c++)
no "hello world " output (c++)
如果我 运行 code::blocks 默认控制台 c++ "hello world" 应用程序(见下文),我只会在打开的控制台中看到它:
Process returned 0 (0x0) execution time : 0.011 s
Press any key to continue.
我没看到 "hello world"。有什么问题吗?
如果我使用 cygwin 运行./helloworld.exe,我会看到 "hello world"。但是我用cmd或者powershell都看不到。
应用程序:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
您可能想在此处查看相关讨论:
http://www.tomsguide.com/forum/244674-49-basic-program
根据我上面提到的论坛,这可能是程序执行太快的问题,但这似乎是一个奇怪的原因。您可以尝试他们推荐的方法(暂停等),但您的编译器或属性设置方式也可能存在问题。
对于 cmd,检查一下:
https://www.thecrazyprogrammer.com/2015/09/how-to-run-c-and-cpp-program-in-cmd.html
对于命令 line/Windows 提示符,检查一下:
感谢@George。
解决方案是删除 -mwindows 编译器标志。
但是为了让它工作,我需要在再次构建之前删除 .exe。
如果我 运行 code::blocks 默认控制台 c++ "hello world" 应用程序(见下文),我只会在打开的控制台中看到它:
Process returned 0 (0x0) execution time : 0.011 s
Press any key to continue.
我没看到 "hello world"。有什么问题吗?
如果我使用 cygwin 运行./helloworld.exe,我会看到 "hello world"。但是我用cmd或者powershell都看不到。
应用程序:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
您可能想在此处查看相关讨论:
http://www.tomsguide.com/forum/244674-49-basic-program
根据我上面提到的论坛,这可能是程序执行太快的问题,但这似乎是一个奇怪的原因。您可以尝试他们推荐的方法(暂停等),但您的编译器或属性设置方式也可能存在问题。
对于 cmd,检查一下:
https://www.thecrazyprogrammer.com/2015/09/how-to-run-c-and-cpp-program-in-cmd.html
对于命令 line/Windows 提示符,检查一下:
感谢@George。
解决方案是删除 -mwindows 编译器标志。
但是为了让它工作,我需要在再次构建之前删除 .exe。