reading from stdin

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

 



L.S.

I would like to compile C code by feeding it to gcc (or cc) from stdin, instead of specifying an input file. What I want would result in a command line like:

    echo "ThisWouldNeedToBeCcode" | gcc -o out.o


(Note aside:
This may look as an awkward or even useless construct at first glance. However that's not the point. I supplied this example invocation to keep the case simple and to the point. In reality I want to invoke such a command from a scripting language, where not using files for input does make sense. I do not want to clutter this case with issues regarding the scripting language.)


The above command line and several variants that I tried, evoke the following complaint:

    gcc: no input files

which, of course, is very much true.


Is reading from stdin simply not supported?


In case it is relevant, here's the output from "gcc -v":

Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.1/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.1 (SuSE Linux)



Thanks in advance for any help,

Erik Leunissen
==============


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux