在MacOS中,尝试在C++的多线程中传入参数,发现报错:
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
添加如下编译指令
如果还是不行就再加一个默认构造函数
eg:
加完立马不报错了,乌鱼子😓