How can I pipe a c program to gcc

Eric Meijer tgakem
Fri Sep 17 01:33:00 GMT 1999


Makarand Kulkarni (makkulka@cisco.com) wrote:
: Hi
: 
: I am trying to find a way to pipe a C program to gcc.
: For example I would like to do this --
: cat  file.c  | gcc -xc  -whateverflags  to compile file.c
: What flags should I use ? Is this possible ?

Usually to use stdin as input `file', you can use `-'.  However, if you
type

gcc -o prog -

you get the answer

gcc: -E required when input is from standard input

And this means that you can only do it if all you run is the
preprocessor.  I guess it is not possible to compile a program this way
because the compiler needs to be able to seek backwards in the file.

HTH,
Eric

-- 
 E.L. Meijer (tgakem@pebbles.chem.tue.nl)
 Eindhoven Univ. of Technology
 Lab. for Catalysis and Inorg. Chem. (SKA)


More information about the Gcc-help mailing list