Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

jsoncpp no operator matches these operands ">>"

My C++ program below is supposed to read a json file called english.json and display the "title" information.

#include <iostream>
#include <fstream>
#include <json/value.h>

using namespace std;

int main()
{
    Json::Value language;
    ifstream language_file("english.json", std::ifstream::binary);
    language_file >> language;

    cout << language["title"] << endl;

    return 0;
}

But when I run the program, I get this error :
E0349 No operator ">>" matches these operands

I’ve tried using other functions in the jsoncpp library but I’m getting more errors and this method seems to be the simplest and most effective.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

<json/value.h> doesn’t include the full implementation of JsonCpp, you need to include <json/json.h> instead.

operator >> is defined in the json/reader.h header

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading