gpt4 book ai didi

clion - std::thread 参数类型不匹配:表达式必须是右值

转载 作者:行者123 更新时间:2023-12-04 19:01:56 24 4
gpt4 key购买 nike

我在 Mint Maya 上安装了 CLion 1.2,并安装了 gcc5。默认 gcc 是 4.6。 (/usr/bin/gcc -> gcc-4.6)
通过 CMakeLists 和 Settings 设置的编译器
【工具链设置】https://www.dropbox.com/s/se5nxfdki7zdkhm/screen_settings_toolchain.png
【 sample 】https://www.dropbox.com/s/ss7r6kss64k00ez/screen.png

编辑说:参数类型不匹配:表达式必须是 std::thread t1(f1) 上的右值,但我可以构建并运行此示例

怎么了?

样本:

void f1(){
cout<<"hi"<<endl;
}
int main() {
cout << "Hello, World!" << endl;
std::thread t1(f1);//Parameter type mismatch: Expression must be rvalue
t1.join();
return 0;
}

最佳答案

我相信这是一个解析器 bug克里昂的
更新

Affected versions: CLion 1.2

Fix versions: CLion 2016.1

关于clion - std::thread 参数类型不匹配:表达式必须是右值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35523561/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com