www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/08/05/03:02:57

Date: Wed, 5 Aug 92 16:54:36 EST
From: s923230 AT minyos DOT xx DOT rmit DOT OZ DOT AU (Paul Gortmaker)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Complex Numbers (complex.h)

I am trying to use the complex number include file complex.h, and am
having some trouble. Here is a simple program that exhibits the same 
difficulty

// COMPLEX.CXX -- does not link math funtions in complex.h with libm.a
#include <stdio.h>
#include <complex.h>  // Also a path to math.h and stream.h
int main(void)
{
complex i;
i=(0,1);
cout << i << endl;
return(0);
}

I am running GCC on a 80486. This program will compile and produce an 
object file with "gcc -c complex.cxx" with no warnings or errors.
However, if I try and link it (either by "gcc complex.cxx -lm" or by
"ld complex.o -lm") it seems to not link the functions in the include
file with libm.a, and prints a stream of error messages such as:

complex.o :Undefined symbol _exp referenced from text segment

There is one for each math function, sin, cos, sinh, etc. If I am using
just real numbers, (so no "#include <complex.h>") and link with libm.a
(via gcc (filename) -lm) everything works fine.

Oh yeah, it's version 2.0 -- and thanks in advance for any help.

Paul Gortmaker.
s923230 AT minyos DOT xx DOT rmit DOT oz DOT au
Melbourne Aus.

- Raw text -


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