How do I use a shared library (in this case JsonCpp) in my C++ program on Linux?
- by Not Joe Bloggs
I'm a new-ish C++ programmer, and I'm doing my first program on my own using C++. I decided I would like to use JSON to store some of the data I'm going to be using, and I've found a library to handle JSON, JsonCpp.
I've installed the library using my Linux system's package manager, and in my C++ code, I've used in my source code file
#include <json>
and compiled it using g++ and it's -ljson and -L/usr/lib options (libjson.so is located in /usr/lib).
However, the first usage of Json::Value, an object provided by the library, gives a compilation error of "Json has not declared". I'm sure my mistake is something simple, so could someone explain what I'm doing wrong? None of the books I had mention how to use shared libraries, so I've had to google to find this much.