cc1plus: error: opción de línea de comandos no reconocida "- std = c++11 " con g++


Estoy tratando de compilar usando g++ y las banderas -std=c++11 o c++0x.

Sin embargo, me sale este error

cc1plus: error: unrecognized command line option "-std=c++11"

G++ version version

g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Copyright (C) 2006 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.
Author: antonijn, 2013-02-03

4 answers

Viendo desde su versión de G++, necesita actualizarlo mal. C++11 solo ha estado disponible desde G++ 4.3. La versión más reciente es 4.7.

En versiones anteriores a G++ 4.7, tendrás que usar -std=c++0x, para versiones más recientes puedes usar -std=c++11.

 89
Author: antonijn,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-02-03 21:16:04

Citando el sitio web del ccg :

Las características de C++11 están disponibles como parte del compilador "mainline" de GCC en el tronco del repositorio Subversion de GCC y en GCC 4.3 y versiones posteriores. Para habilitar la compatibilidad con C++0x, agregue el parámetro de línea de comandos-std=c++0x a la línea de comandos de g++. O bien, para habilitar extensiones de GNU además de las extensiones de C++0x, agregue-std = gnu++0x a su línea de comandos de g++. GCC 4.7 y posteriores soportan -std = c++11 y-std=gnu++11 también.

Así que probablemente tú utilice una versión de g++ que no sea compatible con -std=c++11. Intenta -std=c++0x en su lugar.

La disponibilidad de las características de C++11 es solo para versiones >= 4.3.

 11
Author: stefan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-02-03 16:30:48

Deberías probar esto

g++-4.4 -std=c++0x or g++-4.7 -std=c++0x
 3
Author: papo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-20 17:04:19

También tengo el mismo error, compilando con-D flag arreglado, prueba esto:

G++-Dstd = c++11

 -4
Author: pankaj kushwaha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-05 06:52:58