From: Martin Ambuhl 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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 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 ) are complex where T is an arithmetic class and the header just provides the typedefs typedef complex float_complex; typedef complex double_complex; typedef complex long_double_complex; before #include 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