jfjobidon
jfjobidon

Reputation: 327

linking jsoncpp on Ubuntu

I try to use jsoncpp library with c++ on Ubuntu. I compiled the code and built the library with scons. Now I can compile a simple programme:

#include "json/json.h"
#include <json/value.h>
#include <json/writer.h>
int main()
{
    return 0;
}

I use this command to compile:

g++ test.cpp -usr/lib/libjson_linux-gcc-4.8_libmt

I conclude that the compiler knows where to find the library. The problem comes when I declare a json object:

Json::Value root;

Then I have this error message: undefined reference to « Json::Value::Value(Json::ValueType) »

How can I fix this problem?

Upvotes: 2

Views: 3098

Answers (1)

Eka
Eka

Reputation: 15000

For CodeBlocks (Ubuntu 14.04)

I have faced same problem in my codeblocks IDE after installing jsconcpp. This is how I rectified my problem.

Got to project>Build Options>linker settings and in the link libraries add jsconcpp and click ok

Upvotes: 1

Related Questions