bug in g++: cannot redefine endl

Reiner Suikat Reiner.Suikat@dlr.de
Tue Oct 6 23:28:00 GMT 1998


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

binutils version

I am unable to redefine iostream functions (e.g. endl). The linker
complains about a symbol changing its size and terminates without error

#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 &)':
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.


Reiner Suikat

More information about the Gcc-bugs mailing list