1. Download JsonCpp from here.
2. Create a new folder decompress and extract JsonCpp there:
$ mkdir /home/youruser/JsonCpp $ tar xzf /home/youruser/JsonCpp/jsoncpp-src-0.5.0.tar.gz
3. Donwload the SCONS software construction tool from here and decompress and extract it in the jsoncpp-src-0.5.0 folder.
$ tar xzf /home/youruser/JsonCpp/jsoncpp-src-0.5.0/scons-local-1.3.0.tar.gz
4. Copy the contents of scons-local-1.3.0 inside jsoncpp-src-0.5.0
5. Go to jsoncpp-src-0.5.0 and build JsonCpp using SCONS:
$ cd /home/youruser/JsonCpp/jsoncpp-src-0.5.0 $ python scons.py platform=linux-gcc check
5. Install the JsonCpp library and header files:
$ sudo cp /home/youruser/JsonCpp/jsoncpp-src-0.5.0/libs/linux-gcc-4.4.5/libjson_linux-gcc-4.4.5_libmt.so /usr/lib $ sudo mkdir /usr/include/jsoncpp $ sudo cp /home/youruser/JsonCpp/jsoncpp-src-0.5.0/include/json/* /usr/include/jsoncpp/
6. Finally open your Eclipse project, go to Project -> Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> libraries and add json_linux-gcc-4.4.5_libmt.
That's all you need to start using JsonCpp in Eclipse
Thank you very very very much, I'm actually writing this before even testing your tutorial, just so happy that I found something about the subject!
ReplyDeleteHi,
ReplyDeletethanks again for this article, it was really very helpful! I tested your example code in the other article and I had no problem. But I have a question, why did we have to add the library name to the linker in Eclipse while we already installed it ?
Another question if I may, the name for my case was : json_linux-gcc-4.6_libmt, I assumed I had to "guess" it from : libjson_linux-gcc-4.6_libmt.so, but I have no idea what all this is about, could you please point me to a link where I can read more about the subject ?
Again, thanks a lot, you saved me hours of search since I was getting lost in the documentation, and precise articles like yours are a gift!
I'm glad the post was helpful for you.
DeleteAs soon as I have a bit of time, I'll try to answer your questions.
This comment has been removed by the author.
DeleteI have done all the steps and successfully complted but when I compile my code it is showing "fatal error: json/json.h: No such file or directory" although the jsoncpp file is there in /usr/include path.How to solve this problem?please help me.
ReplyDelete