Subject: b19 and complex numbers
From: [email-masked] (Bruce Conroy)

15 Apr 1998 07:15:06 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: [email-masked]

I'm having trouble linking c++ programs that use complex
numbers under b19. I get errors involving multiple definitions
of the complex operators.

I have extracted a small program that links and runs fine
under b18, but not b19. The program and error message are
included at the end of the message.

Is this a problem with my installation or with b19?
If it is b19, is it a known bug?

Thanks in advance

Bruce Conroy
[email-masked]

The program
--------------------------------------
#include <complex>
#include <iostream.h>
typedef complex<double> Complex;

// cosine integral
// computes integral from ll to ul of cos(a(x+b))
Complex cos_1(Complex a, double b, double ll, double ul)
{
Complex temp;

if(a==0.0)  temp=(ul-ll);
else        temp=1.0/a*(sin(a*(ul+b))-sin(a*(ll+b)));

return temp;
}

int main (void)
{
    Complex x(1.0, 0.0);
    double a=0.0, b=1.0, c=2.0;
    cout << cos_1(x, a, b, c) << endl;
    return 0;
}

---------------------------------------
The error
---------------------------------------
C:\GNUWIN32\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\../../../libstdc++.a(dcomplex.o):
In function `complex<double> _dv<double>(complex<double> const &,
double)':

/home/noer/src/97r2/devo/libstdc++/std/complext.h:237: multiple definition
of `complex<double> operator/<double>(complex<double> const &, double)'

C:\WINDOWS\TEMP\cc0010121.o(.text$__dv__H1Zd_RCt7complex1ZX01X01_t7complex1ZX01+0x0):comtest.cc:
first defined here

C:\GNUWIN32\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\../../../libstdc++.a(dcomplex.o):
In function `complex<double> _ml<double>(complex<double> const &,
complex<double> const &)':

/home/noer/src/97r2/devo/libstdc++/std/complext.h:209: multiple definition
of `complex<double> operator*<double>(complex<double> const &,
complex<double> const &)'

C:\WINDOWS\TEMP\cc0010121.o(.text$__ml__H1Zd_RCt7complex1ZX01T0_t7complex1ZX01+0x0):comtest.cc:
first defined here

C:\GNUWIN32\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\../../../libstdc++.a(dcomplex.o):
In function `complex<double> _mi<double>(complex<double> const &,
complex<double> const &)':

/home/noer/src/97r2/devo/libstdc++/std/complext.h:182: multiple definition
of `complex<double> operator-<double>(complex<double> const &,
complex<double> const &)'

C:\WINDOWS\TEMP\cc0010121.o(.text$__mi__H1Zd_RCt7complex1ZX01T0_t7complex1ZX01+0x0):comtest.cc:
first defined here

C:\GNUWIN32\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\../../../libstdc++.a(fcomplex.o):
In function `complex<float> _dv<float>(complex<float> const &, float)':

/home/noer/src/97r2/devo/libstdc++/std/complext.h:237: multiple definition
of `complex<float> operator/<float>(complex<float> const &, float)'

C:\WINDOWS\TEMP\cc0010121.o(.text$__dv__H1Zf_RCt7complex1ZX01X01_t7complex1ZX01+0x0):comtest.cc:
first defined here

C:\GNUWIN32\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\../../../libstdc++.a(ldcomplex.o):
In function `complex<long double> _dv<long double>(complex<long double>
const &, long double)':

/home/noer/src/97r2/devo/libstdc++/std/complext.h:237: multiple definition
of `complex<long double> operator/<long double>(complex<long double> const
&, long double)'

C:\WINDOWS\TEMP\cc0010121.o(.text$__dv__H1Zr_RCt7complex1ZX01X01_t7complex1ZX01+0x0):comtest.cc:
first defined here
---------------------------------------

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".