Fatmarik
Fatmarik

Reputation: 979

Setting std=c99 flag in GCC

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

Upvotes: 74

Views: 178934

Answers (3)

lswiski
lswiski

Reputation: 21

export CFLAGS="-std=c99"
export CC="gcc"

make 

Some distributions and in most UNIX based OS's have aliases or wrappers for this stuff.

Upvotes: 2

Thomas Pornin
Thomas Pornin

Reputation: 74382

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 gcc after having added the -std=c99 flag, which is precisely what you want.

Upvotes: 115

dirkgently
dirkgently

Reputation: 111120

How about alias gcc99= gcc -std=c99?

Upvotes: 19

Related Questions