C语言 在 GCC 中设置 std=c99 标志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2193634/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 04:23:01  来源:igfitidea点击:

Setting std=c99 flag in GCC

cprogramming-languagesc99

提问by Fatmarik

I was wondering if there were any files in which I could set the -std=c99flag, so that I would not have to set it for every compilation. I am using GCC 4.4 on Ubuntu.

我想知道是否有任何文件可以设置-std=c99标志,这样我就不必为每个编译设置它。我在 Ubuntu 上使用 GCC 4.4。

回答by Thomas Pornin

Instead of calling /usr/bin/gcc, use /usr/bin/c99. This is the Single-Unix-approved way of invoking a C99 compiler. On an Ubuntu system, this points to a script which invokes gccafter having added the -std=c99flag, which is precisely what you want.

而不是调用/usr/bin/gcc,使用/usr/bin/c99. 这是单一 Unix 认可的调用 C99 编译器的方式。在 Ubuntu 系统上,这指向一个gcc在添加-std=c99标志后调用的脚本,这正是您想要的。

回答by dirkgently

How about alias gcc99= gcc -std=c99?

怎么样alias gcc99= gcc -std=c99