Compile for c++14 on CentOS 6

897 Views Asked by At

I have a C++ program that uses various C++14 features, and have been asked to compile it for a CentOS 6 system. GCC doesn't support C++14 features on CentOS 6 as far as I can tell (and based on compiler errors).

Is it possible to compile for C++14 on CentOS 6?

Assuming someone has created a whole compatibility layer for compiling C++14 on CentOS6, could I even distribute that executable? Or would the target machine ALSO have to install a compatibility layer?

I recall reading (years ago) about how to use different development toolchains at once, including I think those later than what was supported by the repos for the OS. Just can't recall details.

1

There are 1 best solutions below

2
b-john On

No, it is not possible to compile C++14 on CentOS 6. Only some C++11 features are available on CentOS 6.

CentOS runs GCC 4.4.7 where-in C++14 features start to become available with GCC 4.9 and higher.

The Boost libraries may be used to replicate some modern C++ features if on an outdated GCC version.