0

I have gcc 4.8.5 installed on a Red Hat 7.5 machine. I wish to compile a software package on this machine. In order to compile this package, I need to run "make". However, when I run this, I see the following error message "error: ‘make_unique’ is not a member of ‘std’". My understanding (possibly incorrect) is that this message originates from the fact that 4.8.5 uses C++11 and "make_unique" requires C++14. So I presume the way to compile this is to specify that C++14 should be used when I run "make". How do I do this ?

I have tried to set the C++ to 14 as follows: cmake -G "Unix Makefiles" -D CMAKE_CXX_STANDARD=14

And then I ran "make".

But this gave the same error message.

didjek
  • 393
  • 5
  • 16
  • Sounds like a bug in whatever software you're trying to build. – Jonathon Reinhart May 06 '20 at 11:21
  • Just to be clear, you're using `cmake` here to generate your makefiles. You should tag this question with `cmake` not `makefile`. But, the problem has nothing to do with `cmake` either as shown below. – MadScientist May 06 '20 at 13:20
  • ok, I have tagged accordingly, as you can surmise from my question, I am not very familiar with this area, hence my poor categorization. – didjek May 06 '20 at 13:52

2 Answers2

0

You are using compiler that does not support C++14. As stated in the documentation:

GCC supports the original ISO C++ standard (1998) and contains experimental support for the second ISO C++ standard (2011).

It is no surprise, since GCC 4.8 was originally released in 2013 so it would be weird if it implemented a standard introduced a year later.

raspy
  • 3,995
  • 1
  • 14
  • 18
  • You need GCC 5.2 (or higher) if you want C++14 support; see this question & answers: https://stackoverflow.com/questions/31965413/compile-c14-code-with-g – MadScientist May 06 '20 at 13:26
  • Even more clear is the GCC docs themselves: https://gcc.gnu.org/projects/cxx-status.html#cxx14 – MadScientist May 06 '20 at 13:35
0

To use C++14 or even C++17 you can compile it with RH Devtoolset 8. The built software would run on target OS w/o any additional effort due to the "nature" of DTS compiler: the symbols available in the OS-shipped libstdc++ gonna be resolved dynamically, while C++11 and above gonna be linked to you executable from the specially built static libstdc++.a provided by DTS.

zaufi
  • 6,811
  • 26
  • 34