In problem (2) in my previous email I cited code Listing 2, but this compilation error was actually generated by code Listing 3, as follows:
// This program is identical to
// listing2.cpp except that it
// uses Boost.Bind to simplify
// the creation of a thread that
// takes data.
#include
#include
#include
#include <iostream>
boost::mutex io_mutex;
void count(int id)
{
for (int i = 0; i < 10; ++i)
{
boost::mutex::scoped_lock
lock(io_mutex);
std::cout << id << ": " <<
i << std::endl;
}
}
int main(int argc, char* argv[])
{
boost::thread thrd1(boost::bind(&count, 1));
boost::thread thrd2(boost::bind(&count, 2));
thrd1.join();
thrd2.join();
return 0;
}
The errors are:
listing3.C:29: no matching function for call to `bind ({unknown type}, int)'
listing3.C:31: no matching function for call to `bind ({unknown type}, int)'
Thanks
[Non-text portions of this message have been removed]