bug in g++: cannot redefine endl
Reiner Suikat
Reiner.Suikat@dlr.de
Tue Oct 6 23:28:00 GMT 1998
Hello,
I believe I ran into a bug in egcs-1.1b (the bug is also in gcc2.8.1,
which is the reason why I tried egcs).
Configuration:
i686-pc-linux-gnulibc1
binutils version 2.9.1.0.4
I am unable to redefine iostream functions (e.g. endl). The linker
complains about a symbol changing its size and terminates without error
message.
Testprog:
#include <iostream.h>
ostream & endl(ostream& os) {
// nothing
return os;
}
void main() {
cout << endl;
}
compiling this with g++ testprog.cpp yields:
/usr/local/lib/libstdc++.a(iostream.o): In function `endl(ostream &)':
/root/pdsw/egcs-1.1b/objdir/i686-pc-linux-gnulibc1/libio/../../../libio/iostream.cc:914:
multiple definition of `endl(ostream &)'/tmp/ccVhRWoJ.o(.text+0x0):
first defined here
/usr/bin/ld: Warning: size of symbol `endl(ostream &) ' changed from 20
to 35 in iostream.o
collect2: ld returned 1 exit status
What is the problem? Is this a bug or is something wrong with my
installation? I have installed egcs (and gcc2.8.1 before that) following
the instructions.
BTW, the same program compiles fine with gcc2.8.1 on an SGI machine.
Thanks
Reiner Suikat
More information about the Gcc-bugs
mailing list