当前位置:  开发笔记 > 编程语言 > 正文

提升初学者,提升::绑定梦魇

如何解决《提升初学者,提升::绑定梦魇》经验,为你挑选了1个好方法。

我有这个标题(从增强asio示例重做):

    #ifndef MSGSRV_H_
#define MSGSRV_H_
#include 
#include 
#include 
#include 
#include 


namespace msgSrv {

class msgSrv {

private:
    asio::ip::udp::socket *asioSocket;
    asio::io_service *asioIoService;
    int listenPort;
    boost::array rcvBuff;
    asio::ip::udp::endpoint lastRcvdPcktEndp;

public:
    msgSrv(int listenPort);
    virtual ~msgSrv();

    void start();
    void pckRcvd( boost::system::error_code &, std::size_t);
};

}

和.cpp:

#include "msgSrv.h"

namespace msgSrv {

    msgSrv::msgSrv(int listenPort) {
        // TODO Auto-generated constructor stub
        this->listenPort = listenPort;
        try{
            asioIoService = new asio::io_service();
            asioSocket =  new asio::ip::udp::socket(*asioIoService, asio::ip::udp::endpoint(asio::ip::udp::v4(), listenPort)); //new asio::ip::udp::socket_(*asioIoService, udp::endpoint(udp::v4(), listenPort));
        }catch(std::exception &e){
            std::cerr << "Error initializing ioservice or socket:" << e.what();
        }
    }

    msgSrv::~msgSrv() {
        // TODO Auto-generated destructor stub
        delete asioIoService;
        delete asioSocket;
    }

    void msgSrv::start(){



        asioSocket->async_receive_from(
                asio::buffer(rcvBuff), lastRcvdPcktEndp,
                boost::bind(&msgSrv::pckRcvd, this,
                  asio::placeholders::error,
                  asio::placeholders::bytes_transferred));

    }

    void msgSrv::pckRcvd( boost::system::error_code &error, std::size_t bytesRcvd){
        std::cout << "Rcvd!\n";
    }

}

现在,它拒绝编译,给出了不可理解的结果:

> make all 
Building file: ../src/msgSrv/msgSrv.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/msgSrv/msgSrv.d" -MT"src/msgSrv/msgSrv.d" -o"src/msgSrv/msgSrv.o" "../src/msgSrv/msgSrv.cpp"
/usr/include/boost/bind.hpp: In member function ‘void boost::_bi::list3::operator()(boost::_bi::type, F&, A&, int) [with F = boost::_mfi::mf2, A = boost::_bi::list2, A1 = boost::_bi::value, A2 = boost::arg<1> (*)(), A3 = boost::arg<2> (*)()]’:
/usr/include/boost/bind/bind_template.hpp:61:   instantiated from ‘typename boost::_bi::result_traits::type boost::_bi::bind_t::operator()(A1&, A2&) [with A1 = asio::error::basic_errors, A2 = int, R = void, F = boost::_mfi::mf2, L = boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()>]’
/usr/include/asio/detail/bind_handler.hpp:95:   instantiated from ‘void asio::detail::binder2::operator()() [with Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Arg1 = asio::error::basic_errors, Arg2 = int]’
/usr/include/asio/handler_invoke_hook.hpp:62:   instantiated from ‘void asio::asio_handler_invoke(Function, ...) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>]’
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ‘void asio_handler_invoke_helpers::invoke(const Function&, Context*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>, Context = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >]’
/usr/include/asio/detail/bind_handler.hpp:129:   instantiated from ‘void asio::detail::asio_handler_invoke(const Function&, asio::detail::binder2*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>, Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Arg1 = asio::error::basic_errors, Arg2 = int]’
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ‘void asio_handler_invoke_helpers::invoke(const Function&, Context*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>, Context = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>]’
/usr/include/asio/detail/handler_queue.hpp:191:   instantiated from ‘static void asio::detail::handler_queue::handler_wrapper::do_call(asio::detail::handler_queue::handler*) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>]’
/usr/include/asio/detail/handler_queue.hpp:171:   instantiated from ‘asio::detail::handler_queue::handler_wrapper::handler_wrapper(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>]’
/usr/include/asio/detail/handler_alloc_helpers.hpp:137:   instantiated from ‘asio::detail::handler_ptr::handler_ptr(asio::detail::raw_handler_ptr&, Arg1&) [with Arg1 = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>, Alloc_Traits = asio::detail::handler_alloc_traits, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>, asio::detail::handler_queue::handler_wrapper, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int> > >]’
/usr/include/asio/detail/handler_queue.hpp:116:   instantiated from ‘static asio::detail::handler_queue::handler* asio::detail::handler_queue::wrap(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>]’
/usr/include/asio/detail/task_io_service.hpp:190:   instantiated from ‘void asio::detail::task_io_service::post(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>, Task = asio::detail::epoll_reactor]’
/usr/include/asio/impl/io_service.ipp:125:   instantiated from ‘void asio::io_service::post(Handler) [with CompletionHandler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error::basic_errors, int>]’
/usr/include/asio/detail/reactive_socket_service.hpp:1376:   instantiated from ‘void asio::detail::reactive_socket_service::async_receive_from(asio::detail::reactive_socket_service::implementation_type&, const MutableBufferSequence&, typename Protocol::endpoint&, int, Handler) [with MutableBufferSequence = asio::mutable_buffers_1, Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Protocol = asio::ip::udp, Reactor = asio::detail::epoll_reactor]’
/usr/include/asio/datagram_socket_service.hpp:310:   instantiated from ‘void asio::datagram_socket_service::async_receive_from(typename asio::detail::reactive_socket_service >::implementation_type&, const MutableBufferSequence&, typename Protocol::endpoint&, int, ReadHandler) [with MutableBufferSequence = asio::mutable_buffers_1, ReadHandler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Protocol = asio::ip::udp]’
/usr/include/asio/basic_datagram_socket.hpp:756:   instantiated from ‘void asio::basic_datagram_socket::async_receive_from(const MutableBufferSequence&, typename Protocol::endpoint&, ReadHandler) [with MutableBufferSequence = asio::mutable_buffers_1, ReadHandler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Protocol = asio::ip::udp, DatagramSocketService = asio::datagram_socket_service]’
../src/msgSrv/msgSrv.cpp:37:   instantiated from here
/usr/include/boost/bind.hpp:348: error: no match for call to ‘(boost::_mfi::mf2) (msgSrv::msgSrv*&, asio::error::basic_errors&, int&)’
/usr/include/boost/bind/mem_fn_template.hpp:272: note: candidates are: R boost::_mfi::mf2::operator()(T*, A1, A2) const [with R = void, T = msgSrv::msgSrv, A1 = boost::system::error_code&, A2 = unsigned int]
/usr/include/boost/bind/mem_fn_template.hpp:291: note:                 R boost::_mfi::mf2::operator()(T&, A1, A2) const [with R = void, T = msgSrv::msgSrv, A1 = boost::system::error_code&, A2 = unsigned int]
/usr/include/boost/bind.hpp: In member function ‘void boost::_bi::list3::operator()(boost::_bi::type, F&, A&, int) [with F = boost::_mfi::mf2, A = boost::_bi::list2, A1 = boost::_bi::value, A2 = boost::arg<1> (*)(), A3 = boost::arg<2> (*)()]’:
/usr/include/boost/bind/bind_template.hpp:61:   instantiated from ‘typename boost::_bi::result_traits::type boost::_bi::bind_t::operator()(A1&, A2&) [with A1 = asio::error_code, A2 = int, R = void, F = boost::_mfi::mf2, L = boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()>]’
/usr/include/asio/detail/bind_handler.hpp:95:   instantiated from ‘void asio::detail::binder2::operator()() [with Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Arg1 = asio::error_code, Arg2 = int]’
/usr/include/asio/handler_invoke_hook.hpp:62:   instantiated from ‘void asio::asio_handler_invoke(Function, ...) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>]’
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ‘void asio_handler_invoke_helpers::invoke(const Function&, Context*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>, Context = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >]’
/usr/include/asio/detail/bind_handler.hpp:129:   instantiated from ‘void asio::detail::asio_handler_invoke(const Function&, asio::detail::binder2*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>, Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Arg1 = asio::error_code, Arg2 = int]’
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ‘void asio_handler_invoke_helpers::invoke(const Function&, Context*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>, Context = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>]’
/usr/include/asio/detail/handler_queue.hpp:191:   instantiated from ‘static void asio::detail::handler_queue::handler_wrapper::do_call(asio::detail::handler_queue::handler*) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>]’
/usr/include/asio/detail/handler_queue.hpp:171:   instantiated from ‘asio::detail::handler_queue::handler_wrapper::handler_wrapper(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>]’
/usr/include/asio/detail/handler_alloc_helpers.hpp:137:   instantiated from ‘asio::detail::handler_ptr::handler_ptr(asio::detail::raw_handler_ptr&, Arg1&) [with Arg1 = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>, Alloc_Traits = asio::detail::handler_alloc_traits, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>, asio::detail::handler_queue::handler_wrapper, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int> > >]’
/usr/include/asio/detail/handler_queue.hpp:116:   instantiated from ‘static asio::detail::handler_queue::handler* asio::detail::handler_queue::wrap(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>]’
/usr/include/asio/detail/task_io_service.hpp:190:   instantiated from ‘void asio::detail::task_io_service::post(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>, Task = asio::detail::epoll_reactor]’
/usr/include/asio/impl/io_service.ipp:125:   instantiated from ‘void asio::io_service::post(Handler) [with CompletionHandler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, int>]’
/usr/include/asio/detail/reactive_socket_service.hpp:1390:   instantiated from ‘void asio::detail::reactive_socket_service::async_receive_from(asio::detail::reactive_socket_service::implementation_type&, const MutableBufferSequence&, typename Protocol::endpoint&, int, Handler) [with MutableBufferSequence = asio::mutable_buffers_1, Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Protocol = asio::ip::udp, Reactor = asio::detail::epoll_reactor]’
/usr/include/asio/datagram_socket_service.hpp:310:   instantiated from ‘void asio::datagram_socket_service::async_receive_from(typename asio::detail::reactive_socket_service >::implementation_type&, const MutableBufferSequence&, typename Protocol::endpoint&, int, ReadHandler) [with MutableBufferSequence = asio::mutable_buffers_1, ReadHandler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Protocol = asio::ip::udp]’
/usr/include/asio/basic_datagram_socket.hpp:756:   instantiated from ‘void asio::basic_datagram_socket::async_receive_from(const MutableBufferSequence&, typename Protocol::endpoint&, ReadHandler) [with MutableBufferSequence = asio::mutable_buffers_1, ReadHandler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Protocol = asio::ip::udp, DatagramSocketService = asio::datagram_socket_service]’
../src/msgSrv/msgSrv.cpp:37:   instantiated from here
/usr/include/boost/bind.hpp:348: error: no match for call to ‘(boost::_mfi::mf2) (msgSrv::msgSrv*&, asio::error_code&, int&)’
/usr/include/boost/bind/mem_fn_template.hpp:272: note: candidates are: R boost::_mfi::mf2::operator()(T*, A1, A2) const [with R = void, T = msgSrv::msgSrv, A1 = boost::system::error_code&, A2 = unsigned int]
/usr/include/boost/bind/mem_fn_template.hpp:291: note:                 R boost::_mfi::mf2::operator()(T&, A1, A2) const [with R = void, T = msgSrv::msgSrv, A1 = boost::system::error_code&, A2 = unsigned int]
/usr/include/boost/bind.hpp: In member function ‘void boost::_bi::list3::operator()(boost::_bi::type, F&, A&, int) [with F = boost::_mfi::mf2, A = boost::_bi::list2, A1 = boost::_bi::value, A2 = boost::arg<1> (*)(), A3 = boost::arg<2> (*)()]’:
/usr/include/boost/bind/bind_template.hpp:61:   instantiated from ‘typename boost::_bi::result_traits::type boost::_bi::bind_t::operator()(A1&, A2&) [with A1 = asio::error_code, A2 = unsigned int, R = void, F = boost::_mfi::mf2, L = boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()>]’
/usr/include/asio/detail/bind_handler.hpp:95:   instantiated from ‘void asio::detail::binder2::operator()() [with Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Arg1 = asio::error_code, Arg2 = unsigned int]’
/usr/include/asio/handler_invoke_hook.hpp:62:   instantiated from ‘void asio::asio_handler_invoke(Function, ...) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>]’
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ‘void asio_handler_invoke_helpers::invoke(const Function&, Context*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>, Context = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >]’
/usr/include/asio/detail/bind_handler.hpp:129:   instantiated from ‘void asio::detail::asio_handler_invoke(const Function&, asio::detail::binder2*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>, Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, Arg1 = asio::error_code, Arg2 = unsigned int]’
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ‘void asio_handler_invoke_helpers::invoke(const Function&, Context*) [with Function = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>, Context = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>]’
/usr/include/asio/detail/handler_queue.hpp:191:   instantiated from ‘static void asio::detail::handler_queue::handler_wrapper::do_call(asio::detail::handler_queue::handler*) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>]’
/usr/include/asio/detail/handler_queue.hpp:171:   instantiated from ‘asio::detail::handler_queue::handler_wrapper::handler_wrapper(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>]’
/usr/include/asio/detail/handler_alloc_helpers.hpp:137:   instantiated from ‘asio::detail::handler_ptr::handler_ptr(asio::detail::raw_handler_ptr&, Arg1&) [with Arg1 = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>, Alloc_Traits = asio::detail::handler_alloc_traits, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>, asio::detail::handler_queue::handler_wrapper, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int> > >]’
/usr/include/asio/detail/handler_queue.hpp:116:   instantiated from ‘static asio::detail::handler_queue::handler* asio::detail::handler_queue::wrap(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>]’
/usr/include/asio/detail/task_io_service.hpp:190:   instantiated from ‘void asio::detail::task_io_service::post(Handler) [with Handler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>, Task = asio::detail::epoll_reactor]’
/usr/include/asio/impl/io_service.ipp:125:   instantiated from ‘void asio::io_service::post(Handler) [with CompletionHandler = asio::detail::binder2, boost::_bi::list3, boost::arg<1> (*)(), boost::arg<2> (*)()> >, asio::error_code, unsigned int>]’
/usr/include/asio/detail/reactive_socket_service.hpp:1353:   instantiated from ‘void asio::detail::reactive_socket_service::receive_from_operation::complete(const asio::error_code&, size_t) [with MutableBufferSequence = asio::mutable_buffers_1, Handler = boost::_bi::bind_t, boost::_bi::list3, boost::arg<1> (*)(), 

...等等.我真的不知道该怎么办,因为我无法理解错误是什么!



1> CB Bailey..:

由于实例化了大量模板,因此错误消息很长,但大多数都提供了有用的上下文.我采取了第一个错误并剪断了过长的行.

首先,编译器说明错误的位置,以及导致特定模板实例的模板实例化的序列导致错误被实例化.

/usr/include/boost/bind.hpp: In member function ‘void boost::_bi::list3::operator()(boost::_bi::type, F&, A&, int) ...
/usr/include/boost/bind/bind_template.hpp:61:   instantiated from ...
/usr/include/asio/detail/bind_handler.hpp:95:   instantiated from ...
/usr/include/asio/handler_invoke_hook.hpp:62:   instantiated from ...
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ...
/usr/include/asio/detail/bind_handler.hpp:129:   instantiated from ...
/usr/include/asio/detail/handler_invoke_helpers.hpp:39:   instantiated from ...
/usr/include/asio/detail/handler_queue.hpp:191:   instantiated from ...
/usr/include/asio/detail/handler_queue.hpp:171:   instantiated from ...
/usr/include/asio/detail/handler_alloc_helpers.hpp:137:   instantiated from ...
/usr/include/asio/detail/handler_queue.hpp:116:   instantiated from ...
/usr/include/asio/detail/task_io_service.hpp:190:   instantiated from ...
/usr/include/asio/impl/io_service.ipp:125:   instantiated from ...
/usr/include/asio/detail/reactive_socket_service.hpp:1376:   instantiated from ...
/usr/include/asio/datagram_socket_service.hpp:310:   instantiated from ...
/usr/include/asio/basic_datagram_socket.hpp:756:   instantiated from ...

以下是导致所有这些情况发生的代码行:

../src/msgSrv/msgSrv.cpp:37:   instantiated from here

这是真正的错误:

/usr/include/boost/bind.hpp:348: error: no match for call to ‘(boost::_mfi::mf2) (msgSrv::msgSrv*&, asio::error::basic_errors&, int&)’
/usr/include/boost/bind/mem_fn_template.hpp:272: note: candidates are: R boost::_mfi::mf2::operator()(T*, A1, A2) const [with R = void, T = msgSrv::msgSrv, A1 = boost::system::error_code&, A2 = unsigned int]
/usr/include/boost/bind/mem_fn_template.hpp:291: note:                 R boost::_mfi::mf2::operator()(T&, A1, A2) const [with R = void, T = msgSrv::msgSrv, A1 = boost::system::error_code&, A2 = unsigned int]

对于参数传递的目的,msgSrv::msgSrv*&将转换为msgSrv::msgSrv*,但A1参数是一个参考,boost::system::error_codeasio::error::basic_errors不是参考兼容.

编辑:

如果您阅读了读处理程序的类型要求,您将看到处理程序可以使用第一个参数,该参数是类型的l值const error_code.这意味着您的第一个参数必须是const boost::system::error_code&(即const引用)boost::system::error_code或非参考参数.

推荐阅读
mobiledu2402851203
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有