From: greve AT rs1 DOT thch DOT uni-bonn DOT de (Thomas Greve) Subject: Complex -- compiler bug? To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Wed, 1 Jul 92 15:55:48 NFT After Stuart M Lichtenthal has asked me about the `Complex' class, i've tried it myself now and i've made the following experiences: - the program *compiles* fine, BUT at the linking stage, there remain `undefined symbols'. - The errors I get upon linking are like: complex.o: Undefined symbol _hypot referenced from text. complex.o: Undefined symbol _atan2 referenced from text. I had a whole bunch of them. Even though i included libm (this is where these functions -- exp, log, sin, cos too -- reside) and -- yes -- i told gcc *correctly* ;-). - Recompiling (and ar[chive?]ing) libm changes *nothing*. - Then i tried to use one of these functions elsewhere: void dummy( void ) { double x = cos(3.14); } Afterwards -- surprize! -- the warning about `undefined _cos' had vanished... - calling the other undefined functions from that dummy function made the remaining linker errors disappear: the program linked fine, and it worked. Summary: obviously, g++ has a bug, that lets the linker forget to link functions called by unused methods (this is sort of an optimization ;-) and complain about them missing afterwards... (this is a bug). Please, could someone forward this to the appropriate GNU address? (This has nothing to do with DJ's work, i guess...) - Thomas greve AT rs1 DOT thch DOT uni-bonn DOT de unt145 AT dbnrhrz1