didjek
didjek

Reputation: 451

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.

Upvotes: 0

Views: 2510

Answers (2)

zaufi
zaufi

Reputation: 7129

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.

Upvotes: 0

raspy
raspy

Reputation: 4261

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.

Upvotes: 0

Related Questions