You can't create a pointer-to-member-function by applying &
to just the name. You need the fully qualified member: &MainM::someFunction
.
And also bind it to an instance, by passing this
, e.g.
#include <thread>
struct MainM
{
void someFunction() {
}
void main()
{
std::thread th(&MainM::someFunction, this);
}
};
int main()
{
MainM m;
m.main();
}