Re: standard OS defines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 22 August 2007 15:47:25 Stephen Kratzer wrote:
> On Wednesday 22 August 2007 15:28:17 Bryan Christ wrote:
> > Thanks!  This list is exactly what I was looking for.  Too bad there's
> > not a tool for piping to gcc--I was trying to avoid -D.
> >
> > Bryan
>
> This is about as ugly as it gets, but here it is anyway:
>
> echo -e "#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif" | cat -
> infile.c | gcc -x c -o outfile.c -
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

The outfile shouldn't have a .c extension since it's a binary. My bad. The 
following is slightly cleaner, but not much:

sed '1 i\#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif\n' infile.c | 
gcc -x c -o outfile -
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux