Skip to content
Advertisement

cpp multipleThread: detach non-class type error

I’m writing a program with mutiplethread using cpp , but I have a compiler-error like this: error message my code could be presented as follow:

JavaScript

So anybody have a clue about where I did wrong and what can I do?

Advertisement

Answer

JavaScript

You’ve hit C++’s Most Vexing Parse. The above declaration doesn’t declare a turnCam as a std::thread object. Rather threadCam is declared as a function that returns a std::thread. Use an extra pair of parenthesis or use uniform brace initialization syntax.

JavaScript

BTW, you will need to have an overloaded operator()(...) in your class for the above to work.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement