delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/21/12:17:15

From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Complex problem Help needed!
Date: Mon, 21 Sep 1998 11:44:54 -0400
Organization: Nocturnal Aviation
Lines: 58
Message-ID: <36067476.7B6A8FD2@earthlink.net>
References: <3606181F DOT 9BE081B2 AT bigfoot DOT com>
NNTP-Posting-Host: 1cust177.tnt14.nyc3.da.uu.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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