The following code piece does not compile for me:
#include <iostream>
#include <boost/thread.hpp>
int main(int argc, char* argv[])
{
  boost::thread thread(
                []() {
                    std::cout<<"hello";
                }
            );
}
With the error :
no matching function for call to ‘boost::thread::thread(main(int, char**)::<lambda()>)’
I feel like I am making a very stupid mistake here, but it has been sometime, and i still fail to find it.
                        
You need to capture
io_serviceby reference to get the above code snippet to compile:Note that the
io_servicedoes not implement copy semantics.