How to enable c11 on later versions of gcc?

限于喜欢 提交于 2019-11-29 02:49:56
ouah

The correct option is -std=c11.

However, it 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.

Note that the current version of gcc is gcc 8.2.

Just to let you know GCC 4.9.x has far more complete support than older versions. If you really need to use this feature, please switch to anything 4.8+ Here is the support status -- https://gcc.gnu.org/wiki/C11Status

gcc 5.2.0 works with command line option ‘-std=c11’

Inside a .spec file :

%define gcc_ver %(if [[ $(gcc -dumpversion) > 4.7 ]]; then echo 1; else echo 0; fi)
# Do we use c11 ?
%if 0%{?gcc_ver} < 1
  %global std_c11 0
%else
  %global std_c11 1
%endif

# if the configure of the package supports it add :
%if %{std_c11}
  --enable-cxx11 \
%endif
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!