I am attempting to do this in vs.net 2003:
int f(HANDLE, HANDLE, HANDLE);
int main(int argc, char* argv[])
{
HANDLE x;
HANDLE y;
HANDLE z;
boost::thread* p = new boost::thread(boost::bind(f, x, y, z);
p->join();
delete p;
}
As a contrived example it works. In my project it does not, spewing
out 5 errors:
1) c:\src\include\boost\bind.hpp(62) : error C2825: 'F::result_type':
cannot form a qualified name
c:\src\include\boost\bind\bind_template.hpp(16) : see reference
to class template instantiation 'boost::_bi::result_traits' being
compiled with
[
R=boost::_bi::unspecified,
F=int (__cdecl *)(HANDLE,HANDLE)
]
c:\src\ansa-1.0\src\main\main.cpp(369) : see reference to class
template instantiation 'boost::_bi::bind_t' being compiled
with
[
R=boost::_bi::unspecified,
F=int (__cdecl *)(HANDLE,HANDLE),
L=boost::_bi::list3::
B1,boost::_bi::list_av_3::B2,boost::_bi::
list_av_3::B3>
]
2) c:\src\include\boost\bind.hpp(62) : error C2039: 'result_type' : is
not a member of 'operator``global namespace'''
3) c:\src\include\boost\bind.hpp(62) : error C2146: syntax error :
missing ';' before identifier 'type'
4) c:\src\include\boost\bind.hpp(62) : error C2955: 'boost::_bi::type'
: use of class template requires template argument list
c:\src\include\boost\bind.hpp(94) : see declaration of
'boost::_bi::type'
5) c:\src\include\boost\bind.hpp(62) : fatal error C1903: unable to
recover
from previous error(s); stopping compilation
note: fd_xpt is declared as "typedef HANDLE fd_xpt;", and
c:\src\ansa-1.0\src\main\main.cpp(369) is similar to "boost::thread* p
= new boost::thread(boost::bind(f, x, y, z);" in the example.
It appears that the compiler thinks my first argument is a "int
(__cdecl *)(HANDLE,HANDLE)" when it is most certainly a "int (__cdecl
*)(HANDLE,HANDLE,HANDLE)". It used to take two arguments, but I've
since added a third (it was at this very point that these errors
crashed the party). I am sure that there is no declaration that
specifies only two arguments: I've had two other developers verify
this. I have cleaned my project multiple times, even by hand, as well
as getting a clean source tree from cvs, and yet I still get these
errors.
Any suggestions on how to silence these errors are greatly appreciated.
--mpeltzer goochrules@hotmail.com