Boost logo

Boost Users :

Subject: [Boost-users] Difficulty compiling - ASIO/BIND
From: David (spam3_at_[hidden])
Date: 2008-10-17 02:25:26


Hi,

I'm trying to use asio, and I run into a compiler error when using
async_connect. I don't think this is an asio issue, perhaps a compiler or bind
issue. Errors and code snippet below. I'm perplexed by the error, as apparently
the compiler can't if 'this' should be passed as a pointer, or by reference. I
also tried alternate syntax using bind and mem_fn as mentioned in the bind docs,
but that gave exactly the same error.

What's causing this error, and what can I do to fix it?

using gcc 4.2.3:

.../boost_1_36_0/boost/bind.hpp:292: error: no match for call to
‘(boost::_mfi::mf1<void, Connection, boost::system::error_code&>) (Connection*&,
boost::asio::error::basic_errors&)’
.../boost_1_36_0/boost/bind/mem_fn_template.hpp:160: note: candidates are: R
boost::_mfi::mf1<R, T, A1>::operator()(T*, A1) const [with R = void, T =
Connection, A1 = boost::system::error_code&]
.../boost_1_36_0/boost/bind/mem_fn_template.hpp:179: note: R
boost::_mfi::mf1<R, T, A1>::operator()(T&, A1) const [with R = void, T =
Connection, A1 = boost::system::error_code&]

//code

class Connection
{
public:
//...
 void onConnected(boost::system::error_code&);
//...
};

_socket.lowest_layer().async_connect(*_epit,
boost::bind(&Connection::onConnected, this, placeholders::error));


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