Search code examples
makefilecmakec++14redhat

How to use make with C++14 with gcc 4.8.5 on RedHat 7.5


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.


Solution

  • 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.