这是我第一次在c ++中使用线程,我遇到了一些问题。我收到错误
<div class="row">
<div class="col-md-7">
<table class="table h-100">
..
</table>
</div>
<div class="col-md-5">
<div class="row text-white h-100">
<div class="col-md-12 pb-3">
<div class="bg-dark h-100">B</div>
</div>
<div class="col-md-12">
<div class="bg-dark h-100">C</div>
</div>
</div>
</div>
</div>
这是我的代码摘录:
error: no matching function for call to ‘std::thread::thread(<unresolved overloaded function type>, __gnu_cxx::__alloc_traits<std::allocator<packetInfo> >::value_type*)’
我完全不知道我做错了什么,或者为什么我会收到错误。
感谢。
答案 0 :(得分:5)
错误直接告诉你:
<unresolved overloaded function type>
您必须有多个renewIP
重载,并且编译器不知道您想要哪个。您可以重命名它们以使它们不模糊,或通过强制转换使其显式:
std::thread renewTimer((void(*)(struct packetInfo*))renewIP, &(sentPackets[i]));