Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#63 libjson not useable with -std=c++11

Matthew Woehlke

libjson cannot be used if compiled with -std=c++11 due to failure to resolve certain overloaded method calls. The problem comes from libjson treating this is "ISO_STRICT" and disabling overloads that take the data type 'long long', which is defined in -std=c++11 mode. This leads to errors like:
error: call of overloaded ‘JSONNode(const char [3], long long int)’ is ambiguous
...as gcc does not consider JSONNode(const json_string&, long int) as an unambiguous match.

I believe libjson should either not force JSON_ISO_STRICT in C++11 mode (whether with or without GNU extensions), or must at least recognize that absence of GNU extensions does not necessarily mean that 'long long' should not be used.


  • I will try to update it to use C++11 in the next release.

  • Thanks. I'll also add that this is the only issue I know of with building it with -std=c++11, so hopefully giving a usable library with in that mode won't be hard.


  • Anonymous

    I've discovered another problem with the c++11 option.


    will produce the following compilation error when c++11 is turned on.

    Undefined symbols for architecture x86_64:
    "internalJSONNode::operator long() const", referenced from:
    JSONNode::as_int() const in libjson_example.o
    ld: symbol(s) not found for architecture x86_64
    collect2: error: ld returned 1 exit status

    If I remove the c++11 flag and remove the 11 features it compiles and runs without issue.

    Last edit: Anonymous 2014-12-18
  • jboHAb <a href="http://nrusvafzuahm.com/">nrusvafzuahm</a>, [url=http://cfvlucthuaxs.com/]cfvlucthuaxs[/url], [link=http://cmpscgmkwkrh.com/]cmpscgmkwkrh[/link], http://suvfgfgdwtwy.com/