From 9dd77dc0efeb3a89311c49d64e6761095c629e1e Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Tue, 24 Mar 2015 18:07:12 +0200 Subject: [PATCH 1/2] Revert "Use std namespace for snprintf." This reverts commit 1c58876185d2a4ed87dac4a54b82f607e74f55fd. std::snprintf() is only available in C++11, which is not provided by all compilers. Since the C library snprintf() can easily be used as a replacement on Linux systems, this patch changes jsoncpp to use the C library snprintf() instead of C++11 std::snprintf(), fixing the build error below: src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std' See #231, #224, and #218. --- src/lib_json/json_writer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index 83102fd..f7ad1e2 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -29,8 +29,6 @@ #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below #define snprintf _snprintf -#else -#define snprintf std::snprintf #endif #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 From 240ddb6a1b7aae7c6528e328995812ee695a73af Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Tue, 31 Mar 2015 12:39:44 -0500 Subject: [PATCH 2/2] use std::snprintf for C++11 --- src/lib_json/json_writer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index f7ad1e2..ef976bf 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -29,6 +29,8 @@ #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below #define snprintf _snprintf +#elif __cplusplus >= 201103L +#define snprintf std::snprintf #endif #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0