g++/cpp problem with macros expanding to /##/

Kamil Iskra kamil@dwd.interkom.pl
Sun Oct 4 03:18:00 GMT 1998

On 3 Oct 1998, Alexandre Oliva wrote:

> > Is there a simple way to get two preprocessor passes?
> g++ -E - < file.cc | g++ -E - > file.ii && g++ file.ii
> > I haven't figured out how to get g++ to take input from
> > stdin.
> The pre-processor will read from stdin; the C++ compiler won't

Not really. The gcc/g++ drivers are unhappy what reading from stdin since
they can't decide by the filename extension what type of input this is, so
they insist on -E.

However, if you specify the type of input with "-x c++-cpp-output", it
works fine:

g++ -E file.cc | g++ -E - | g++ -x c++-cpp-output -

/ Kamil Iskra    AmigaOS  Linux/i386  Linux/m68k               \
| GeekGadgets m68k-amigaos GCC maintainer                      |
| iskra@student.uci.agh.edu.pl  kiskra@ernie.icslab.agh.edu.pl |
\ kamil@dwd.interkom.pl   http://student.uci.agh.edu.pl/~iskra /

More information about the Gcc-bugs mailing list