While trying to use std::threads i found myself with this error.
error C2064: term does not evaluate to a function taking 1 arguments
File: functional
Line:1152
After commenting out some lines and such i found that the error comes from the constructor.
I am also using irrlicht therefore the event variable.
Here is the declaration of the thread:
t1=new thread((&EventReceiver::KeyInput3),event);
The header of the function:
int EventReceiver::KeyInput3(const SEvent& event)
Tryed constructing it in various way but none worked. What should I do in order to get rid of the error?
I am guessing KeyInput
is not a static member function, so you need to pass a pointer to an instance of EventReceiver
first:
EventReceiver* p = ...;
std::thread t(&EventReceiver::KeyInput3, p, event);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.