I'm using boost::threads for spawning multiple threads and in order to use functors for thread i'm using boost::bind but including <boost/bind.hpp> in my file util.hpp gives following errors:(I'm using FC 8 with g++ version 4.1.2).
--------------------------------------------------------------
In file included from /usr/include/boost/bind.hpp:1642,
from util.hpp:1(i'm including the boost/bind.hpp),
from hClass.h:12,(includes util.hpp)
from feat.h:13:(includes util.hpp)
/usr/include/boost/bind/placeholders.hpp:31:32: error: macro "_2" requires 2 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:32:32: error: macro "_3" requires 3 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:33:32: error: macro "_4" requires 4 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:34:32: error: macro "_5" requires 5 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:35:32: error: macro "_6" requires 6 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:36:32: error: macro "_7" requires 7 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:37:32: error: macro "_8" requires 8 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:38:32: error: macro "_9" requires 9 arguments, but only 1 given
/usr/include/boost/bind/placeholders.hpp:31: error: invalid function declaration
/usr/include/boost/bind/placeholders.hpp:32: error: invalid function declaration
/usr/include/boost/bind/placeholders.hpp:33: error: invalid function declaration
/usr/include/boost/bind/placeholders.hpp:34: error: invalid function declaration
/usr/include/boost/bind/placeholders.hpp:35: error: invalid function declaration
/usr/include/boost/bind/placeholders.hpp:36: error: invalid function declaration
/usr/include/boost/bind/placeholders.hpp:37: error: invalid function declaration
/usr/include/boost/bind/placeholders.hpp:38: error: invalid function declaration
I have realy tried hard but couldn't find whats the problem and how to resolve it, but to no avail. if i comment the <boost/bind.hpp> there are no errors and compiler complains that there is no bind in boost...
{// local block for the thread group
boost::thread_group tgroup;
for(UINT j=0; j < np+1;++j)
{
presult[j].clear();
if(j==0)
{
tgroup.add_thread(new boost::thread(
boost::bind(&Ft:::ScanFt,
rfilter,hinfo,presult[j])));
}
else
{
tgroup.add_thread(new boost::thread(
boost::bind(&Ft:::ScanFt,
pfilter,hinfo2,presult[j])));
}
}
tgroup.join_all();
}// local block for the thread group