如何启用海合会更高版本的C11? [英] How to enable c11 on later versions of gcc?

查看:238
本文介绍了如何启用海合会更高版本的C11?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用 GCC 4.6.3 。我的理解是, GCC 默认使用 gnu89 标准,我想使C11,最新的C标准。我想:

I currently use gcc 4.6.3. My understanding is that gcc by default uses the gnu89 standard and I would like to enable C11, the latest C standard. I tried:

[pauldb@pauldb-laptop test ]$ gcc -std=c11 -o test test.c
cc1: error: unrecognised command line option ‘-std=c11’

我换成 C11 gnu11 ,我也得到了同样的错误。什么是正确的方法,使海合会最新的C标准?

I replaced c11 with gnu11 and I get the same error. What is the correct way to enable the latest C standard for gcc?

(注:我感兴趣的是最新的C标准,而不是最新的C ++一个)

(Note: I'm interested in the latest C standard and not the latest C++ one.)

推荐答案

-std = C11 是正确的选择,但不可用于 GCC 4.6

-std=c11 is the correct option but is not available in gcc 4.6.

您至少需要 GCC 4.7 有这个选项的支持。在一些老版本的如 GCC 4.6 ,选择 -std = C1X 是可利用的实验(即非常有限)支持C11的。

You need at least gcc 4.7 to have this option supported. In some older versions like gcc 4.6, the option -std=c1x was available with experimental (i.e., very limited) support of C11.

另外请注意,当前版本的 GCC GCC 4.8.0

Also note that the current version of gcc is gcc 4.8.0.

这篇关于如何启用海合会更高版本的C11?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆