Skip to content

Non-C++ 11 branch is using C++ 11 detection #286

Closed
@holiveros

Description

@holiveros

Trying to use jsoncpp 1.6.2 on Cygwin, using g++ 4.9.2 with C++ 11 features enabled; compilation fails on:
/jsoncpp-1.6.2/dist/jsoncpp.cpp:3969:18: error: ‘snprintf’ is not a member of ‘std’

Switching to non-C++ 11 jsoncpp branch, 0.10.2, yields a similar error:
/jsoncpp-0.10.2/dist/jsoncpp.cpp:3790:18: error: ‘snprintf’ is not a member of ‘std’

Turns out Cygwin has a bug where std::snprintf is not included when using C++ 11 features.

Checking amalgamated jsoncpp.cpp, turns out it still has C++ 11 detection, which it shouldn't have:
line 3787:

if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below

define snprintf _snprintf

elif __cplusplus >= 201103L

define snprintf std::snprintf

endif

What applies in this case besides removing the std:: from that define?
Compiling a C++ 11 project, using jsoncpp in non-C++ 11 in non-lib mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions