www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/05/02:37:04

Via: uk.ac.de-montfort; Mon, 3 Oct 1994 14:08:06 +0100
From: Brian Bramer <bb AT de-montfort DOT ac DOT uk>
Date: Mon, 3 Oct 94 14:08:28 BST
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Problems with using complex numbers

There is a problem comiling programs using complex numbers in 2.6.0.
The header file <complex.h> contains an error in the line
   #include <Complex.h> 
which should read
   #include <_Complex.h> 
   
If the -Wall option is on then one gets lots of compile time warnings, e.g.:
  c:/djgpp/cplusinc/_Complex.h:171: warning: `operator ==
    (const Complex &, const Complex &)' was declared `extern' and later `static'
These appear to be caused by function definitions being declared inline 
whereas previous prototypes were not (just ignore them).

One then gets link errors, e.g.:
   x.cc(.text+0x1f): undefined reference to `Complex::Complex(double, double)'
   x.cc(.text+0x2f): undefined reference to `Complex::~Complex(void)'

A similar problem was reported recently when using the setw(), setiosflags(), 
etc. manipulators in <iomanip.h>, e.g.:
   P13_5.cc(.text+0x85): undefined reference to 
                      `operator<<(ostream &, smanip<int> const &)'

By undefining the named constant __GNUG__ and recompiling these go away, i.e.:
#undef __GNUG__
#include <complex.h> 
#include <iomanip.h>

Brian Bramer, (bb AT dmu DOT ac DOT uk) De MontFort University, UK.

- Raw text -


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