Boost logo

Boost Users :

Subject: [Boost-users] Boost threads with arguments
From: Jamie Lahowetz (deadpickle_at_[hidden])
Date: 2012-06-03 16:11:08


I am trying to pass two arguments to a boost thread using this call:
boost::thread workerthread(&SshClient::SSHconnect,&sshclt,1,provec);

the method for SSHconnect is:
int SSHconnect(int,vector<string>);

When I try to make my program I get the errors:
/usr/include/boost/bind/bind.hpp: In member function ‘void
boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&, int)
[with F = int (SshClient::*)(int, std::vector<std::basic_string<char> >), A
= boost::_bi::list0, A1 = boost::_bi::value<SshClient*>, A2 =
boost::_bi::value<int>]’:
/usr/include/boost/bind/bind_template.hpp:20:59: instantiated from
‘boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F,
L>::operator()() [with R = void, F = int (SshClient::*)(int,
std::vector<std::basic_string<char> >), L =
boost::_bi::list2<boost::_bi::value<SshClient*>, boost::_bi::value<int> >,
boost::_bi::bind_t<R, F, L>::result_type = void]’
/usr/include/boost/thread/detail/thread.hpp:61:17: instantiated from
‘void boost::detail::thread_data<F>::run() [with F =
boost::_bi::bind_t<void, int (SshClient::*)(int,
std::vector<std::basic_string<char> >),
boost::_bi::list2<boost::_bi::value<SshClient*>, boost::_bi::value<int> >
>]’
terminal.cpp:271:1: instantiated from here
/usr/include/boost/bind/bind.hpp:313:9: error: no match for call to
‘(boost::_mfi::dm<int(int, std::vector<std::basic_string<char> >),
SshClient>) (SshClient*&, int&)’
/usr/include/boost/bind/mem_fn.hpp:314:34: note: candidates are:
/usr/include/boost/bind/mem_fn.hpp:340:9: note: R& boost::_mfi::dm<R,
T>::operator()(T*) const [with R = int(int,
std::vector<std::basic_string<char> >), T = SshClient]
/usr/include/boost/bind/mem_fn.hpp:340:9: note: candidate expects 1
argument, 2 provided
/usr/include/boost/bind/mem_fn.hpp:345:15: note: const R&
boost::_mfi::dm<R, T>::operator()(const T*) const [with R = int(int,
std::vector<std::basic_string<char> >), T = SshClient]
/usr/include/boost/bind/mem_fn.hpp:345:15: note: candidate expects 1
argument, 2 provided
/usr/include/boost/bind/mem_fn.hpp:350:33: note: template<class U> const R&
boost::_mfi::dm::operator()(const U&) const [with U = U, R = int(int,
std::vector<std::basic_string<char> >), T = SshClient]
/usr/include/boost/bind/mem_fn.hpp:357:9: note: R& boost::_mfi::dm<R,
T>::operator()(T&) const [with R = int(int,
std::vector<std::basic_string<char> >), T = SshClient]
/usr/include/boost/bind/mem_fn.hpp:357:9: note: candidate expects 1
argument, 2 provided
/usr/include/boost/bind/mem_fn.hpp:362:15: note: const R&
boost::_mfi::dm<R, T>::operator()(const T&) const [with R = int(int,
std::vector<std::basic_string<char> >), T = SshClient]
/usr/include/boost/bind/mem_fn.hpp:362:15: note: candidate expects 1
argument, 2 provided
make[2]: *** [terminal.o] Error 1
make[2]: Leaving directory `/home/deadpickle/hprcc_terminal/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/deadpickle/hprcc_terminal'
make: *** [all] Error 2

Quite a long error. Not sure what to make of it and could use some help.
thank you.

-- 
Jamie Ryan Lahowetz
University of Nebraska - Lincoln
Graduate Student - Earth and Atmospheric Sciences
402.304.0766
jlahowetz_at_[hidden]


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