[英]OpenGL crash just by removing std::cout<<“hi”<<std::endl from the program
[英]std::endl results in crash
在开发一个简单的例子(我没有编写C ++一段时间)的过程中,我遇到了一个奇怪的行为。 在Windows下运行hello world程序崩溃(Mingw):
#include <iostream>
int main () {
for (int idx = 0; idx < 5; idx++) {
std::cout << "Hello World" << std::endl;
}
return 0;
}
如果我删除std::endl
,程序不会崩溃。
我使用以下命令编译和执行示例,在64位系统和操作系统上使用Mingw32(g ++ 4.8.1):
g++ example.cpp -o example.exe
example.exe
错误消息是:
example.exe不再起作用了......
这是一个已知问题还是我的一个明显错误?
<< endl是一种操作本质上是一种功能。 您的输出无法刷新,这会导致问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.