-1

I used the python amalmagate file to compile the json library. Now when I run the c++ code, I keep getting this error.

/usr/bin/ld: msort.cc:(.text+0x255): undefined reference to Json::Value::~Value()' /usr/bin/ld: msort.cc:(.text+0x264): undefined reference to Json::Value::~Value()' /usr/bin/ld: msort.cc:(.text+0x278): undefined reference to Json::Value::operator[](int)' /usr/bin/ld: msort.cc:(.text+0x28c): undefined reference to Json::Value::Value(char const*)' /usr/bin/ld: msort.cc:(.text+0x2a7): undefined reference to `Json::Value::get(char const*, Json::Value const&) const'

This is what I used to download the jsoncpp library

git clone https://github.com/open-source-parsers/jsoncpp.git

cd jsoncpp

python amalgamate.py

The code I ran to compile: g++ msort.cc -o msort

I understand that this means that the library is not connecting with my code. Any idea how I can fix this?

  • 3
    How are you building your program? Please [edit] your question to show us the commands you use to build. – Some programmer dude Jun 04 '21 at 06:40
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – o11c Jun 06 '21 at 03:09

1 Answers1

0

If you read the instructions for the amalgamated library you will see that you need to build with the library source file dist/jsoncpp.cpp:

g++ msort.cc dist/jsoncpp.cpp -o msort
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621