complex ostream

heinrich roder hro@barney.lanl.gov
Mon Jan 12 17:07:00 GMT 1998


Hi,
why does this now suddenly fail with

/tmp/cca205341.o: In function `main':
/tmp/cca205341.o(.text+0xf6): undefined reference to `ostream & operator<<<float>(ostream &, complex<float> const &)'
collect2: ld returned 1 exit status

Does anybody know what I have messed up?
tqvm Heinrich


#include <iostream.h>
#include <complex.h>

template<class T>
inline T sqr(T x){ return x*x;}

int main(){
  int i=1;
  float f=3.1;
  double d=4.4;
  complex<float> c(3.1,4.1);

  cout << sqr(i) << endl;
  cout << sqr(f) << endl;
  cout << sqr(d) << endl;
  cout << sqr(c) << endl;
  return (0);
}



More information about the Gcc mailing list