这是 g++ 还是 CLion 错误(在 CLion 中使用 Ctrl+D)?
Is this a g++ or CLion bug ( using Ctrl+D in CLion)?
关于使用下面的代码
#include <iostream>
#include <vector>
#include <string>
int main()
{
std::vector<std::string> vec;
std::string temp{};
while(std::cin >> temp) vec.push_back(temp);
std::cout << "\n[ " << vec[0];
for(int i {1}; i < vec.size(); i++) std::cout << ", " << vec[i];
std::cout << "]";
}
具有以下输入
kghukg kjhukg 6887 ^D
我明白了
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
我在 ubuntu 和
上使用 CLion
asmmo@asmmo:~$ g++ --version
g++ (Ubuntu 9.3.0-8ubuntu1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
我在 std=-s++1z
和 c++2a
时遇到了这个错误
考虑到评论,我将代码更新为
#include <iostream>
#include <vector>
#include <string>
#include <thread>
using namespace std::chrono_literals;
int main()
{
std::vector<std::string> vec;
std::string temp{};
while(std::cin >> temp) vec.push_back(temp);
std::cout<<vec.size();
std::this_thread::sleep_for(10s);
std::cout << "\n[ " << vec[0];
for(int i {1}; i < vec.size(); i++) std::cout << ", " << vec[i];
std::cout << "]";
}
然后使用
kjjkj jkh 555 ^D
但它等待 thwn 除了错误
没有显示任何内容
我的心理猜测是,这是 CLion 向程序提交输入的方式的问题。
https://youtrack.jetbrains.com/issue/CPP-5704
I can disable keycaps for ⌘+D and Ctrl-D, and rely on the "Send EOF" action or the ⌘-D and Ctrl-D keypresses with Clion keycaps disabled, the result is the same: the program does not receive a EOF but receives some sort of kill signal.
显然有些人找到了绕过这个的方法:
https://xbuba.com/questions/45803954
Disabling the run.processes.with.pty in Registry (open via Find Action) usually helps.
我从来不理解 Jetbrains 工具的炒作......
关于使用下面的代码
#include <iostream>
#include <vector>
#include <string>
int main()
{
std::vector<std::string> vec;
std::string temp{};
while(std::cin >> temp) vec.push_back(temp);
std::cout << "\n[ " << vec[0];
for(int i {1}; i < vec.size(); i++) std::cout << ", " << vec[i];
std::cout << "]";
}
具有以下输入
kghukg kjhukg 6887 ^D
我明白了
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
我在 ubuntu 和
上使用 CLionasmmo@asmmo:~$ g++ --version
g++ (Ubuntu 9.3.0-8ubuntu1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
我在 std=-s++1z
和 c++2a
考虑到评论,我将代码更新为
#include <iostream>
#include <vector>
#include <string>
#include <thread>
using namespace std::chrono_literals;
int main()
{
std::vector<std::string> vec;
std::string temp{};
while(std::cin >> temp) vec.push_back(temp);
std::cout<<vec.size();
std::this_thread::sleep_for(10s);
std::cout << "\n[ " << vec[0];
for(int i {1}; i < vec.size(); i++) std::cout << ", " << vec[i];
std::cout << "]";
}
然后使用
kjjkj jkh 555 ^D
但它等待 thwn 除了错误
没有显示任何内容我的心理猜测是,这是 CLion 向程序提交输入的方式的问题。
https://youtrack.jetbrains.com/issue/CPP-5704
I can disable keycaps for ⌘+D and Ctrl-D, and rely on the "Send EOF" action or the ⌘-D and Ctrl-D keypresses with Clion keycaps disabled, the result is the same: the program does not receive a EOF but receives some sort of kill signal.
显然有些人找到了绕过这个的方法:
https://xbuba.com/questions/45803954
Disabling the run.processes.with.pty in Registry (open via Find Action) usually helps.
我从来不理解 Jetbrains 工具的炒作......