I'm making program to read and write json file. My code:
#include <bits/stdc++.h>
#include <json/json.h>
#include <json/reader.h>
using namespace std;
int main()
{
ifstream file("input.json");
Json::Value value;
Json::Reader reader;
reader.parse(file, value);
cout << value << endl;
return 0;
}
When I run the program, it's return errors:
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x3f): undefined reference to `Json::Value::Value(Json::ValueType)'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x4b): undefined reference to `Json::Reader::Reader()'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x6b): undefined reference to `Json::Reader::parse(std::istream&, Json::Value&, bool)'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x7e): undefined reference to `Json::operator<<(std::ostream&, Json::Value const&)'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0xaa): undefined reference to `Json::Value::~Value()'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0xdd): undefined reference to `Json::Value::~Value()'
I already try to add param -ljsoncpp
but it said C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ljsoncpp
It's there any way to fix this problem? I installed jsoncpp from https://github.com/open-source-parsers/jsoncpp.