看看这两个代码。
下面的代码工作正常。
void someFunction () {
// Some unimportant stuff
}
MainM::MainM(QObject *parent) :
QObject(parent)
{
std::thread oUpdate (someFunction);
}
此代码引发错误:
void MainM::someFunction () { //as a class member
}
MainM::MainM(QObject *parent) :
QObject(parent)
{
std::thread oUpdate (someFunction);
}
错误:
error: no matching function for call to 'std::thread::thread(<unresolved overloaded function type>)'
std::thread oUpdate (someFunction);
^