Paul Baltescu Paul Baltescu - 28 days ago 17
C Question

How to enable c11 on later versions of gcc?

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’


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

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

Answer

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

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.

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