How can I pipe a c program to gcc

Makarand Kulkarni makkulka@cisco.com
Thu Sep 30 23:56:00 GMT 1999


[ Eric Meijer wrote:

> 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.

On the contrary I am finding that all of the following will work --

cat a.c |  g++  -E -pipe - | g++ -pipe -xc  -o a.out  -
cat a.c | gcc -E  -pipe - | gcc -pipe -xc -o a.out -
cat a.c | gcc -pipe -xc -o a.out -
cat b.c | g++ -pipe -xc++ -o a.out -

--My system--
Linux Sparc 2.0.35, from Redhat 5.2
gcc is egc 2.90.20
Gnu Bash shell 1.14.7(1)
--



More information about the Gcc-help mailing list