How to link jsoncpp?

Donny picture Donny · Feb 9, 2011 · Viewed 7.7k times · Source

How can I link jsoncpp with a C++ program using g++? I tried:

g++ -o program program.cpp -L/path/to/library/files -ljsoncpp, -ljson, -llibjsoncpp

but g++ keeps saying:

/usr/bin/ld: cannot find -lsomething

Answer

Gordon Brandly picture Gordon Brandly · Jun 10, 2011

You could also try using the new Amalgamated version of jsoncpp, which is new as of version 0.6.0.

The Amalgamated version allows you to use jsoncpp by adding just one directory with a couple of header files and one .cpp file to your project. You then can directly compile jsoncpp into your program with no worries about having to link to any jsoncpp libraries.