CLion prints the input back

2019-08-07 13:43发布

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?

标签: clion
2条回答
迷人小祖宗
2楼-- · 2019-08-07 14:23

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.

查看更多
来,给爷笑一个
3楼-- · 2019-08-07 14:24

That's probably because getline returns an istream& parameter

查看更多
登录 后发表回答