Urien
Urien

Reputation: 33

Undefined symbol with JsonCPP library in Linux 64. What am I missing?

I'm using JsonCPP as a parser for Json in C++, the problem is when I declare my var Json::Value root;, its compiles very well but when I use it the program crashes showing this msg: undefined symbol: _ZN4Json5ValueD1Ev. What I missing?

I thought that is was a linker problem so I put my library libjson_linux-gcc-4.1.2_libmt.so in /usr/lib and /usr/lib64, and the .h to /usr/include/json so when I call for the library in my code I do #include <json/json.h>.

Everything is fine because I can compile it very well! but I recieve the same crashes.

Is there any path that I am missing to link?

Thank you all!

PD: I forget to say that I'm not compiling with g++, I'm compiling with a makefile

Upvotes: 0

Views: 1937

Answers (2)

user5623847
user5623847

Reputation: 1

This works for me, putting the libjson_linux-gcc-4.1.2_libmt.so to the same dir of your program located when running it.

Upvotes: 0

nos
nos

Reputation: 229274

In addition to including the header file, you need to link to the library as well.

At the linking stage, add the argument -ljson_linux-gcc-4.1.2_libmt

Upvotes: 1

Related Questions