如何将gcc编译器更改为ubuntu上的c ++ 11 [英] how to change gcc compiler to c++11 on ubuntu
问题描述
我使用ubuntu 12.04和默认gcc是4.6.3。它不接受c ++ 11命令,并给我输出说该命令不是c ++ 98兼容。我检查了在线,并看到人们建议不要改变操作系统上的默认编译器,因为它变得不稳定。任何人都可以建议一个修复或安全的方式下载gcc编译器是c ++ 11兼容。
I use ubuntu 12.04 and the default gcc is 4.6.3. It is not accepting c++11 commands and is giving me output saying the command is not c++98 compatible. I checked online and have seen people advising to not change default compilers on operating system as it becomes unstable. Can anybody suggest a fix or a safe way of downloading a gcc compiler that is c++11 compliant.
推荐答案
gcc 4.6.3 支持许多c ++ 11功能。但是,默认情况下禁用它们。要启用它们,请使用以下标志:
gcc 4.6.3 supports many c++11 features. However, they are disabled by default. To enable them, use the following flag:
g++ -std=c++0x ...
此标志还禁用GNU扩展;要保持其启用,请使用 -std = gnu ++ 0x
标志。
This flag also disables GNU extensions; to keep them enabled, use -std=gnu++0x
flag.
这篇关于如何将gcc编译器更改为ubuntu上的c ++ 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!