delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/05/21/10:59:05

Date: Fri, 21 May 1993 07:58:52 -0600
From: tesla AT lamar DOT ColoState DOT EDU (Jon Nash)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Using the Complex class

Hello,

I have hesitated to ask this question for some time because it seemed to
trivial.  After spending several hours of frustration I've decided that it
isn't that trivial afterall and I'ld like to request a little help!

I have written a small test program:

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

int main(void)
{
  Complex x(1.0,2.0),y(2.0,3.0),z;
                         //oops use z(0,0)...

  z=x+y;
  cout << z.real();
}

When I compile this with Borland C/C++ it does fine.  When I compile this
with GCC I get errors:

complex.o: undefined symbol _sin referenced in text segment...

or something like that.  (The compilation line that I use is
gcc XXX.cc -lm -oXXX

I am new to C++...  What am I doing wrong!?

Thanks in advance.

Jon Nash
Tesla AT Lamar DOT ColoState DOT EDU

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019