www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/26/01:01:16

Xref: news2.mv.net comp.os.msdos.djgpp:3137
From: Roland Exler <R DOT Exler AT jk DOT uni-linz DOT ac DOT at>
Newsgroups: comp.os.msdos.djgpp
Subject: Libraries for Complex-class
Date: Thu, 25 Apr 1996 08:40:12 -0700
Organization: Institute for el. Measurement, University of Linz, Austria
Lines: 41
Message-ID: <317F9CDC.7B5F@jk.uni-linz.ac.at>
NNTP-Posting-Host: sensor4.emt.uni-linz.ac.at
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've a problem switching from V1 to V2 using complex numbers. With V1 I've used
#include<complex.h> and data-type 'complex', but compiling this programs with
V2 gives errors, so I switched to #include<_complex.h> and the Complex-class.
Now all the inlined operators (+,-,*,...) work fine but all divisions gives
errors while linking, see the example below.

I've tried some libraries, but without success. So which library do I have
to link using the Complex-class?

Thanks for any help,
  Roland

---------------------- file test.cc -------------------------------------
#include <stdio.h>
#include <_complex.h>

int main(int argc, char *argv[])
{
  Complex x(1.0,2.0);
  Complex y(2.0,0.0);
  x/=y;
  printf("re:%f im:%f\n",real(x),imag(x));
}
-------------------------------------------------------------------------
gcc -Wall -O2   -m486  test.cc -o test

test.cc: In function `int main(int, char **)':
test.cc:5: warning: unused parameter `int argc'
test.cc:5: warning: unused parameter `char ** argv'
test.cc(.text+0x5c): undefined reference to 
`complex<double>::operator/=(complex<double> const &)'


-- 
+---------------------------------------+---------------------------+
I Roland Exler                          I EMAIL:                    I
I Universitaet Linz                     I R DOT Exler AT jk DOT uni-linz DOT ac DOT at I
I Institut fuer Elektrische Messtechnik I                           I
I Altenbergerstr. 69                    I Phone:                    I
I A-4040 Linz, AUSTRIA                  I + 43 732 2468 9205        I
+---------------------------------------+---------------------------+

- Raw text -


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