Reputation: 171
How do I resolve the following linker error w.r.t jsoncpp operator=.
I create a Json::Value
object like this
Json::Value pt;
pt["type"] = 5;
pt["uuid"] = "f8c74622-d45e-4cfa-fe00-5e7042431c72";
pt["start frame"] = 10;
pt["duration"] = 20;
pt["payload"] = "aedddefffsadf";
This gives the following linker error when I try to link against the default libjsoncpp-dev shipped with Ubuntu 14.04
undefined reference to `Json::Value::operator=(Json::Value)'
extra info:
And I don't get this linker error when compiled and linked against the latest jsoncpp from GitHub.
value.h (installed by ubuntu apt) in /usr/include/jsoncpp/json has
Value &operator=( const Value &other );
and the latest jsoncpp value.h has
Value &operator=(Value other);
Upvotes: 5
Views: 5281
Reputation: 18257
Debian ships with jsoncpp-0.6.0-rc2
. I'll bet Ubuntu does too.
Simply switch to jsoncpp-0.8.z
, which are binary-compatible with 0.6.0-rc2
and include most enhancements and bug-fixes from 1.y.z
.
Actually Debian is switching to 0.8.z
presently. Until Ubuntu updates their shipped version, you might have to avoid new features (mainly the Builders) and instead use the deprecated Readers/Writers, which is probably what you do already. So it should be easy for you to get everything working.
Upvotes: 2