C++ Lambda - error: no matching function for call to
问题 I am trying to pass a lambda as parameter to a function but once I attempt to access a variable inside the lambda which was declared outside, the build fails: error: no matching function for call to 'AWS::subscribe(char [128], mainTask(void*)::<lambda(AWS_IoT_Client*, char*, uint16_t, IoT_Publish_Message_Params*, void*)>)' I was thinking that the [&] would take care of capturing variables. I also tried [=] as well as [someVar] , [&someVar] . I'm using C++11. char someVar[128]; aws->subscribe(