|
Boost Users : |
From: Richard Fox (rfox_at_[hidden])
Date: 2002-05-31 15:39:19
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 <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/bind.hpp>
#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]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net