我有以下代码,我正在尝试通过 ZMQ 发送一条 capnp 消息:
::capnp::MallocMessageBuilder message;
Guitar::Builder guitar = message.initRoot<Guitar>();
guitar.setModel(1);
guitar.setPrice(1200);
kj::Array<capnp::word> words = messageToFlatArray(message);
_publisher.send(words);
我正在使用发布-订阅模式,我收到以下错误:
error: no matching member function for call to
'send'
_publisher.send(words);
~~~~~~~~~~~^~~~ /usr/local/include/zmq.hpp:610:21: note: candidate function not viable: no known conversion from
'kj::Array<capnp::word>' to
'zmq::message_t &' for 1st argument
inline bool send (message_t &msg_, int flags_ = 0)
^ /usr/local/include/zmq.hpp:627:21: note: candidate function not viable: no known conversion from
'kj::Array<capnp::word>' to
'zmq::message_t' for 1st argument
inline bool send (message_t &&msg_, int flags_ = 0)
^ /usr/local/include/zmq.hpp:620:35: note: candidate function template not viable: requires at least 2 arguments,
but 1 was
provided
template<typename I bool send(I first, I last, int flags_=0)
^ /usr/local/include/zmq.hpp:600:23: note: candidate function not viable: requires at least 2 arguments,
but 1 was provided
inline size_t send (const void *buf_, size_t len_, int flags_ = 0)