Search code examples
c++linuxgccc++14icc

gcc and intel's icpc on redhat do not recognize namespace std::literals;


I get an error that ‘literals’ is not a namespace-name when compiling the following

#include <complex>
using namespace std::literals;
...

its compiles fine on Windows with MSVC and even on OS X with clang, but fails on redhat 7 using either gcc and intel's icpc.

some more detail:

the system

 cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

gcc version

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Intel compiler version

icpc --version
icpc (ICC) 16.0.3 20160415
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

compiler call

gcc filename.cpp -std=c++1y
icpc filename.cpp -std=c++14

what am I missing?

ps: Even simple code like in this live demo doesn't work:(


Solution

  • libstdc++ that comes with GCC 4.8.x does not have those literals; they started shipping beginning with GCC 4.9.0.