CLion prints the input back

浪子不回头ぞ 提交于 2019-12-24 11:42:44

问题


Everyone. I've been using CLion for some time and I do like it, except one thing. Maybe somebody had the same problem.

The thing is that when I print something in console, the IDE prints it back. For example, if I run that code

#include <iostream>
#include <string>

int main() {
    std::string message;
    std::getline(std::cin, message);
    std::cout << "You've printed: " << message;
    return 0;
}

the IDE will act like this: Printing back

I think that problem lies in CMake, but as a newy I have no idea how to fix it. Could you help me?


回答1:


That's probably because getline returns an istream& parameter




回答2:


I ran into the same problem.

Seems like it is a known issue, related to MinGW and bugged in JetBrains tracker: https://youtrack.jetbrains.com/issue/CPP-2580#u=1443705085694

It is just an issue with IDE / terminal obviously, program will run properly if run outside of the IDE.



来源:https://stackoverflow.com/questions/35669359/clion-prints-the-input-back

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!