4

I moved my application to another Linux box, after compilation, it returns an error saying

#include <atomic> 

can not be resolved.

I guess the new GNU C++11 header files / libraries are not installed on new machine.

My question is how can I install them?

I am running on Redhat Enterprise, so yum install ?

Thanks.

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
2607
  • 4,037
  • 13
  • 49
  • 64

3 Answers3

8

The Red Hat Developer Toolset provides C++11 support.

(Indeed, I suspect this is the primary reason for its existence.)

Nemo
  • 70,042
  • 10
  • 116
  • 153
  • 2
    +1 Very nice. There is a CentOS test version here: http://people.centos.org/tru/devtools/ – trojanfoe Nov 28 '12 at 09:37
  • Yes, but you should still be careful about mixing binaries built in C++11 mode with binaries built with an older compiler in C++98 mode. [Reference](https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/7/html/user_guide/sect-GCC-CPP#sect-GCC-CPP-Compatibility) – Perennialista Dec 14 '17 at 23:56
1

The include under the version of gcc that comes with RHEL 6 is:

#include <cstdatomic>

See Runtime Library (libstdc++) section of gcc 4.4 releaste notes.

EDIT: This answer is not fully correct, because cstdatomic is the C11 file and not the C++11 one. For full C++ support in RHEL 6, the devtoolset should be used.

Dave Johansen
  • 889
  • 1
  • 7
  • 23
0

Looks like you'll need to install an up to date version of GCC yourself; RHEL (at least as of 6.x) does not have a version of GCC supporting C++0x in it's repositories. You can build recent versions of GCC by following GCC's installation instructions, which are distribution-neutral.

You may also be able to use a package from a more recent Fedora release, which generally contains more "bleeding edge" software than that available in RHEL.

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552