I have just installed libjson from sourceforge.net . I tried executing a simple program But i get this error
‘JSONNode’ was not declared in this scope
Here is the code
#include<iostream>
#include <libjson.h>
int main()
{
JSONNode n(JSON_NODE);
JSONNode c(JSON_ARRAY);
c.push_back(JSONNode("", 16));
c.push_back(JSONNode("", 43));
c.push_back(JSONNode("", 69));
n.push_back(c);
std::string jc = n.write_formatted();
std::cout<<jc<<std::endl;
return 0;
}
M I missing some header file ?
I see that libjson stuff is defined in the json
namespace. Please try adding json::
in front of JSONNode
solve the problem? Like this:
json::JSONNode n(JSON_NODE);
json::JSONNode c(JSON_ARRAY);