New parameter in GCC

Ian Lance Taylor iant@google.com
Tue Aug 2 21:41:00 GMT 2011


Harry Trinta <harrytpc@gmail.com> writes:

> I wonder how do I create a parameter in Gcc.
> For example, I want the user to pass a ip address in the compilation.
> I'll use this ip later.
>
> So the question is, how to record a new parameter in Gcc?

Can you give a code example?

Take a look at the -D option.  It lets you write

gcc -DADDR=127.0.0.1 foo.c

and then in foo.c

  const char *s = ADDR;

Ian



More information about the Gcc-help mailing list