Using libjson in a C++ project

DeX3 picture DeX3 · Aug 7, 2012 · Viewed 8.1k times · Source

I'm trying to use libjson within a C++ project and the docs tell me to just "add libjson's source to your project, comment JSON_LIBRARY in the JSONOptions.h file and any C++ compiler should compile it."

Being quite new to C++ and all that, how exactly am I supposed to do that (not using any IDE)? Should I just #include the libjson.h file and that's it? Shouldn't I reference libjson somehow in my call to g++ when compiling my project?

thx in advance

Answer

ninja9578 picture ninja9578 · Aug 8, 2012

If you go into the libjson library folder, you will see a makefile. Navigate to that directory in a terminal and type:

make

then

make install

Then, in your code

#include <libjson.h>

or, depending on your include path:

#include <libjson/libjson.h>

That should be all that you need to do.

If you need additional help, you can post in the help forum at sourceforge (I am the author of libjson)