问题描述
(C ++的新手)
我有这个简单的代码(为问题简化了):
I have this simple code (simplified for the question):
int main()
{
string currInput;
while (getline(cin, currInput))
{
}
cout << "wont be printed" << std::flush;
return 0;
}
我已经调试了一段时间,我可能会错过一些东西:
I have been debugging for a while and I probably miss something:
运行它并按 + (在某些字符串之后或立即)时,它不会打印while循环之后的字符串.它只是停止运行.我认为这可能与冲洗有关,所以我也添加了这一点.我想念什么?
When running it and pressing + (after some strings or right away), it does not print the string that is after the while loop. It just stop running. I thought it might be something with flushing so I added that too.What am I missing?
PS:在调试中运行时,它会提及有关叹气信号的信息.
PS: When running in debug, it mentions something about sighup signal.
推荐答案
因此,在@manni和@rici的大量帮助下,我们找到了问题所在.
So, with a lot of help from @manni and @rici, we found the problem.
事实证明这是cLion中的一个已知问题.
It turns out to be a known problem in cLion.
https://youtrack.jetbrains.com/issue/IDEA-12514
这篇关于C ++:ctrl + d终止程序(ubuntu)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!