Unable to use std::thread - Part 2
Go to solution
Solved by Pinguinsan,
You must use pointer-to-member-function syntax when passing an instance level method (ie non-static, tied to an instance of MyClass), as well as the "this" pointer when creating a std::thread to an instance level member function.So change
std::thread t(&Func);
to
std::thread t(&MyClass::Func, this);

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now