0

I am trying to install cmake on solaris machine by building its source code. In one of the steps we need to do "make" to build the source code. When I do a make I am getting below error

/json_reader.cpp:35:18: error: ‘snprintf’ is not a member of ‘std’
#define snprintf std::snprintf

This indicates that code is using c++11 std but gcc compiler uses c++98 std. I have gcc version 4.8.2 (GCC) in the solaris machine. As per my knowledge make is wrapper over gcc.

Question is: How to set CFLAGS for gcc globally so that when I do a "make" it directly uses c++ 11 std.

bipll
  • 11,747
  • 1
  • 18
  • 32
Ashwini J
  • 61
  • 1
  • 1
    "This indicates that code is using c++11 std but gcc compiler uses c++98 std."—How's that? cppref only contains one overload of `snprintf` introduced in 11, others were present before that (dragged happily from C). More likely it indicates somehow did not get included in this file. – bipll Jun 20 '18 at 05:55
  • Tried including , but the error is still the same. As you have mentioned the file included only header file. So included as well but still getting the same error. :( – Ashwini J Jun 21 '18 at 05:43
  • 1
    *How to set `CFLAGS` for gcc globally so that when I do a "make" it directly uses c++ 11 std.* You **don't**. `CFLAGS` is "**C** flags", not "C++ flags". You likely want `CXXFLAGS` – Andrew Henle Jun 21 '18 at 18:18

0 Answers0