在MacOS中,尝试在C++的多线程中传入参数,发现报错:no matching constructor for initialization of 'std::thread'
no matching constructor for initialization of 'std::thread'
原因:MacOS的g++使用clang,默认不支持C++11多线程。解决方法:编译指令加上 -std=c++11例如:g++ -std=c++11 fileToCompile.cpp -o outputFile.out
-std=c++11
g++ -std=c++11 fileToCompile.cpp -o outputFile.out
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3