I am trying to compile the code for a sample message package (http://msgpack.org/) and continue to receive these errors, which I cannot get at the bottom:
g++ -o"MsgPack2" ./src/MsgPack2.o -lmsgpack -lmsgpackc
./src/MsgPack2.o: In function `main':
/mnt/eoh/workspace/MsgPack2/Debug/../src/MsgPack2.cpp:38:
undefined msgpack::rpc::server::listen(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, unsigned
short)'
./src/MsgPack2.o: In functionloop link ': /usr/local/include/msgpack/rpc/loop.h:30: undefined mp::wavy::loop::loop()'
./src/MsgPack2.o: In functionbase link ': /usr/local/include/msgpack/rpc/server.h:59: undefined msgpack::rpc::server::server(msgpack::rpc::loop)'
/usr/local/include/msgpack/rpc/server.h:59: undefined reference to
msgpack link :: RPC server :: serve (msgpack :: RPC dispatcher *) "/usr/local/include/msgpack/rpc/server.h:59: undefined link to msgpack::rpc::server::~server()'
./src/MsgPack2.o: In function~ base ': / usr / local / include / msgpack / rpc /server.h:64: undefined link to msgpack::rpc::server::~server()'
./src/MsgPack2.o: In function
MyServer :: dispatcher (msgpack :: RPC request) ': / mnt / eoh / workspace / MsgPack 2 / Debug /../ src / MsgPack2.cpp: 14: undefined link to msgpack::rpc::request::method()'
/mnt/eoh/workspace/MsgPack2/Debug/../src/MsgPack2.cpp:18:
undefined reference tomsgpack :: rpc :: request :: params () '. / src / MsgPack 2.o: In the msgpack::rpc::loop_util<msgpack::rpc::session_pool>::run(unsigned
long)':
/usr/local/include/msgpack/rpc/loop_util.h:34: undefined reference
tomsgpack :: session_pool RPC :: get_loop () "/ usr / local / include / msgpack / rpc / loop _util.h function: 34: undefined link tomp::wavy::loop::run(unsigned long)'
./src/MsgPack2.o: In functionvoid msgpack :: request RPC :: call (intermediate &, msgpack :: Type :: zero &) ': /usr/local/include/msgpack/rpc/request.h:119: undefined link to msgpack::rpc::request::is_sent() const'
/usr/local/include/msgpack/rpc/request.h:122: undefined reference
tomsgpack :: rpc :: request :: get_msgid () const '/usr/local/include/msgpack/rpc/request.h:125: undefined link to msgpack::rpc::request::send_data(msgpack::sbuffer*)'
./src/MsgPack2.o: In functionvoid msgpack :: rpc :: request :: call (msgpack :: type :: nil &, unsigned char &) ': /usr/local/include/msgpack/rpc/request.h:119: undefined link to msgpack::rpc::request::is_sent() const'
/usr/local/include/msgpack/rpc/request.h:122: undefined reference
tomsgpack :: rpc :: request :: get_msgid () const' / usr / local / include / msgpack / rpc / request.h: 125: undefined link to msgpack::rpc::request::send_data(msgpack::sbuffer*)'
./src/MsgPack2.o: In functionvoid msgpack :: rpc :: request :: call, std :: allocator>
(msgpack:: type:: nil &, std:: basic_string, std:: allocator > &) ': /usr/local/include/msgpack/rpc/request.h:119: undefined to msgpack::rpc::request::is_sent() const'
/usr/local/include/msgpack/rpc/request.h:122: undefined reference
to msgpack:: rpc:: request:: get_msgid() const ' /usr/local/include/msgpack/rpc/request.h:125: undefined msgpack::rpc::request::send_data(msgpack::sbuffer*)'
./src/MsgPack2.o: In function __ shared_count ': /usr/include/c ++/4.5/tr1/shared_ptr.h:121: undefined mp::wavy::loop::~loop()'
./src/MsgPack2.o: In function :: TR1:: _ Sp_deleter:: () (.:: :: *) ': /usr/include/c ++/4.5/tr1/shared_ptr.h:99: undefined `.:: :: :: ~ ()" collect2: ld 1 make: * [MsgPack2] 1
:
#include <msgpack/rpc/server.h>
class myserver : public msgpack::rpc::server::base {
public:
void add(msgpack::rpc::request req, int a1, int a2)
{
req.result(a1 + a2);
}
public:
void dispatch(msgpack::rpc::request req)
try {
std::string method;
req.method().convert(&method);
if(method == "add") {
msgpack::type::tuple<int, int> params;
req.params().convert(¶ms);
add(req, params.get<0>(), params.get<1>());
} else {
req.error(msgpack::rpc::NO_METHOD_ERROR);
}
} catch (msgpack::type_error& e) {
req.error(msgpack::rpc::ARGUMENT_ERROR);
return;
} catch (std::exception& e) {
req.error(std::string(e.what()));
return;
}
};
int main(void)
{
myserver svr;
svr.instance.listen("127.0.0.1", 80800);
svr.instance.run(4);
return 0;
}
- - , .
,