void _tcpClientThread() {
for(;;) {
// do something here
}
}
However, when I build it I get the error:
../wiring/inc/spark_wiring_thread.h:53:5: note: Thread::Thread(const char*, wiring_thread_fn_t, os_thread_prio_t, siz
e_t)
Thread(const char *name, wiring_thread_fn_t function,
^
../wiring/inc/spark_wiring_thread.h:53:5: note: no known conversion for argument 2 from '<unresolved overloaded fun
ction type>' to 'wiring_thread_fn_t {aka std::function<void()>}'
You can’t use a non-static function (method) of an object as parameter for Thread::Thread() since the call is unresolvable at compile time.
You’d either need to make the function static or need an overload for Thread::Thread() that also takes an instance pointer to your object (which is not implemented AFAIK).
Thanks, making the method static worked fine (well it builds anyway). Out of curiosity how did you manage to diagnose the problem from the log? I cannot see anything in there that would point me in that direction.
TcpClientComms.cpp:7:98: error: no matching function for call to 'Thread::Thread(const char [23], <unresolved overloaded function type>, const os_thread_prio_t&)'
Thread("TcpClientManagerThread", TcpClientComms::_tcpClientThread, OS_THREAD_PRIORITY_DEFAULT);
From this part TcpClientComms::_tcpClientThread and the statement <unresolved overloaded function type> I gathered that you intended to provide a non-static function as thread function and knowing how C++ does do the target resolution of functions like this made it clear what the issue was.
Hence the absolute need to provide all the error output you get if someone else should make some sense of it without seeing the (complete) code.
But also providing the code is always advisable as well.
e.g. you code snippet in your first post didn’t really tell the whole story
There it wasn’t clear that you were dealing with a class nor that the thread function would be a non-static member of that class.