Undefined symbols for architecture x86_64 jsonrpc library

I have some hardtime compiling an application with QT using the jsonRpc library :
- libjson-rpc-cpp
- jsoncpp
When compiling, I have this error :

Undefined symbols for architecture x86_64:
Json::Value::operator=(Json::Value const&)", referenced from:
  jsonrpc::RpcProtocolServerV1::WrapException(Json::Value const&, jsonrpc::JsonRpcException const&, Json::Value&) in libjson-rpc-cpp.a(rpcprotocolserverv1.o)
  jsonrpc::RpcProtocolServerV1::WrapResult(Json::Value const&, Json::Value&, Json::Value&) in libjson-rpc-cpp.a(rpcprotocolserverv1.o)
  jsonrpc::RpcProtocolServerV1::WrapError(Json::Value const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Json::Value&) in libjson-rpc-cpp.a(rpcprotocolserverv1.o)
  jsonrpc::RpcProtocolServerV2::WrapException(Json::Value const&, jsonrpc::JsonRpcException const&, Json::Value&) in libjson-rpc-cpp.a(rpcprotocolserverv2.o)
  jsonrpc::RpcProtocolServerV2::WrapResult(Json::Value const&, Json::Value&, Json::Value&) in libjson-rpc-cpp.a(rpcprotocolserverv2.o)
  jsonrpc::RpcProtocolServerV2::WrapError(Json::Value const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Json::Value&) in libjson-rpc-cpp.a(rpcprotocolserverv2.o)
  jsonrpc::AbstractProtocolHandler::ProcessRequest(Json::Value const&, Json::Value&) in libjson-rpc-cpp.a(abstractprotocolhandler.o)
  ...

I try to find in value.h the definition of the overload = operator and I find this :

Value& operator=(Value other);

It's probably something to do with a linker issue, but I really don't know how to resolve it..
Can anyone please give me some help with this ? Thank you

Upvotes: 1

Views: 673

Answers (2)

JDA3
JDA3

Reputation: 356

I had the same error when compiling OSVR. The source of the problem was outdated jsoncpp headers in /usr/local/include.

What worked for me:

  • Remove jsoncpp from /usr/local/lib, /usr/local/include
  • Remove libjson-rpc-cpp from /usr/local/lib, /usr/local/include

Build and install jsoncpp, including dynamic library, from github source:

  • git clone --recursive https://github.com/VRPN/jsoncpp
  • git clone --recursive https://github.com/cinemast/libjson-rpc-cpp.git
  • cd jsoncpp
  • cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=ON -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" .
  • make
  • make install
  • cd ../libjson-rpc-cpp
  • cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=ON -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" .
  • make
  • make install

Upvotes: 1

In fact, the version of libjson-rpc-cpp.a was compile with a non update source of jsoncpp library. So I re-generate a libjson-rpc-cpp.a updated and now it works.

Upvotes: 0

Related Questions