65,209
社区成员
发帖
与我相关
我的任务
分享cout<<"this is one thread : "<<(string)arg<<endl;报错了
invalid conversion from 'void*' to 'const char*'[/quote]
转成string类型的指针。std::string* str = (std::string*)(arg);[/quote]
果然可以,赞一个cout<<"this is one thread : "<<(string)arg<<endl;报错了
invalid conversion from 'void*' to 'const char*'[/quote]
转成string类型的指针。std::string* str = (std::string*)(arg);cout<<"this is one thread : "<<(string)arg<<endl;报错了
invalid conversion from 'void*' to 'const char*'
std::string str;
pthread_create(&tid, NULL, threadfunc, &str);
在threadfunc里面,再把参数强制转换成string类型即可。