Mail Archives: djgpp/1998/09/21/12:17:15
Carsten Svaneborg wrote:
>
> Hi.
>
> I need to calculate the sin integral, and the source in numerical
> recepies uses complex numbers, I've implemented it in borland 3.1
> and it works aokey.
>
> Unfortunately now I want to use it under djgpp, and I gives
> me some problems. I.e.
>
> A small test program:
> #include <complex.h>
try
#include "complex.h"
Your code finds the C++ complex class header, not the NR complex.h
header.
Types in the C++ complesx class (in <complex>) are
complex<T> where T is an arithmetic class
and the <complex.h> header just provides the typedefs
typedef complex<float> float_complex;
typedef complex<double> double_complex;
typedef complex<long double> long_double_complex;
before #include <complex>
Since NR is written in C, not C++, you could try renaming your
> void main()
> {
> complex x;
> }
>
> gives me:
> D:\DJGPP\TMP>gpp -c func.cpp
Since NR is written in C, not C++, you might try renaming your input
file as func.c and compiling as C. In any case, make the changes above.
> func.cpp: In function `int main(...)':
> func.cpp:5: `complex' undeclared (first use this function)
> :
>
> So it can find complex.h or it would have generated an error.
> But it won't accept complex??
>
> I wouldn't like to resort to using structs and writing the
> complex math explicitly. Am I doing something strange? The
> short bit of code above compiles OK under borland 3.1.
> --
> from zqex aka zqex_xeqz AT bigfoot DOT com alias Carsten Svaneborg
--
Martin Ambuhl (mambuhl AT earthlink DOT net)
Note: mambuhl AT tiac DOT net will soon be inactive
- Raw text -