+1  A: 

I think you should write boost::asio::placeholders::error instead of ::asio::placeholders::error. Also, I don't understand the purpose of :: you have in front of the boost namespace.

Alex - Aotea Studios
A: 

I think you want boost::system::error_code:

void func2 (const boost::system::error_code& error)
{ }

and also this:

::boost::function<void(boost::system::error_code&)> f2 = ::boost::bind (&func2, boost::asio::placeholders::error);

I find asio's placeholder stuff too verbose, so I'd write this instead:

::boost::function<void(boost::system::error_code&)> f2 = ::boost::bind (&func2, _1);
ergosys
Does it make sense?---void func1 (const intboost::function<void()> f2 = boost::bind(---if the first bind works, why the second one does not?
Leandro
in libasio-doc/asio/examples/http/client/async_client.cpp we have the type asio::error_code and the parameter asio::placeholders::error, and it works.
Leandro
You must be using an old version of boost, < v1.35, right? My response assumed 1.35 or later where system::error_code is used instead of asio::error_code. I tested my answer with v1.38, ymmv.
ergosys
Leandro
Look:---#include <boost/asio.hpp>#include <boost/bind.hpp>#include <boost/function.hpp>#include <boost/system/error_code.hpp>void func (const boost::system::error_code // this doesn't work! f (boost::asio::placeholders::error); return 0;}---
Leandro
boost::asio::placeholders::error is used for bind, you want to pass in an actual boost::system::error_code object there.
ergosys
Leandro