Re: json-glib problem


On 23 May 2013 08:40, Aldrich Niklaus <aldrichnjit gmail com> wrote:

I want to us json-glib to parse a json file ,and I wrote a demo like this.

int main(int argc,char **argv)
        JsonParser *parser;
        GError *error;

if you're using a recent version of GLib, calling g_type_init() is not
strictly necessary.

        JsonNode *root;
        root = json_parser_get_root(parser);

if you're walking through a JSON tree, then you can also use
JsonReader: its API should be slightly easier to use.

and the info.json file is here.
 of Alaska 

but when I compile the demo,I got a segment fault,I do not know what`s wrong with my demo program.

you should look at the stack trace of the segmentation fault by
running your program under gdb; just use:

    gdb --args ./your-demo-program

and type "bt" when the program aborts.

you'll see where the program crashes and hopefully why. in case, copy
the stack trace in a reply.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]