Complex.h file

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Complex.h file

John Coppens
Hi guys & gals.

I'm tying to port a program of mine to cygwin, and have the following
problem:

complex.h is not found.

A search in the cygwin tree reveals:

/usr/lib/i686-pc-mingw32/3.4.4/include/c++/backward/complex.h
/usr/lib/i686-pc-cygwin/3.4.4/include/c++/backward/complex.h
/usr/include/mingw/complex.h

But, as I use gcc, and normal c (not c++), I suspect none of these are
seen. On my Linux machine, all compiles well (same gcc version).

The compiler complains about the missing complex.h and about the complex
type in a file, even though I read gcc has complex C-99 support built-in
since 3.4.1

Can someone help here?
Thanks,
John

PS: The program I'm trying to compile is linsmith, available at
http://sf.net/projects/linsmith

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: Complex.h file

René Berber-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Coppens wrote:
[snip]
> complex.h is not found.
>
> A search in the cygwin tree reveals:
>
> /usr/lib/i686-pc-mingw32/3.4.4/include/c++/backward/complex.h
> /usr/lib/i686-pc-cygwin/3.4.4/include/c++/backward/complex.h
> /usr/include/mingw/complex.h

Easy way out: add the -mno-cygwin parameter to CFLAGS.  That means "use mingw
headers and libraries" to produce a windows only executable (no cygwin dll
dependencies); this will work if the package you are compiling doesn't depend on
libraries not supplied by mingw.

> But, as I use gcc, and normal c (not c++), I suspect none of these are
> seen. On my Linux machine, all compiles well (same gcc version).
>
> The compiler complains about the missing complex.h and about the complex
> type in a file, even though I read gcc has complex C-99 support built-in
> since 3.4.1
[snip]

I'm not sure about the standard, but complex is defined in libstdc++ wich is c++
not c, and I don't have it in gcc 3.4.4 only on 4.0.2 (not distributed with
Cygwin yet).

HTH
- --
René Berber
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iEYEARECAAYFAkN/ZEkACgkQL3NNweKTRgzTxgCfey5vL7UQT+P4UbbWDZvOXbvQ
goQAoP4+jnaFomRuiqyWvPfpm0HXs6Ox
=u521
-----END PGP SIGNATURE-----


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: Complex.h file

Richardson, Anthony
In reply to this post by John Coppens
John Coppens <john <at> jcoppens.com> writes:

> I'm tying to port a program of mine to cygwin, and have the following
> problem:
>
> complex.h is not found.
>
> The compiler complains about the missing complex.h and about the complex
> type in a file, even though I read gcc has complex C-99 support built-in
> since 3.4.1

Well gcc 3.4.4 has built-in support for complex types, i.e. the following works
(without including complex.h)

   _Complex double x = 7 + 8i;
   x += -3 - 4i;
   x *= 2 + 5i;
   x /= 3 - 4i;
   printf("(%f,%f)\n", creal(x), cimag(x));

but it does not have built-in support for all of the complex functions
that are declared in complex.h.  I would assume the "problem" is
more of newlib issue than a gcc one.

Tony Richardson



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: Complex.h file

John Coppens
On Sat, 19 Nov 2005 18:55:33 +0000 (UTC)
Tony Richardson <[hidden email]> wrote:

>    _Complex double x = 7 + 8i;
>    x += -3 - 4i;
>    x *= 2 + 5i;
>    x /= 3 - 4i;
>    printf("(%f,%f)\n", creal(x), cimag(x));
>
> but it does not have built-in support for all of the complex functions
> that are declared in complex.h.  I would assume the "problem" is
> more of newlib issue than a gcc one.

Hi Tony.

That's good news - I couldn't find much info on the nuts and bolts of the
complex stuff in gcc-3.4.x (Is there some manual that is up-to-date? The
gcc manuals I found are from 2002 or older).

I just tried to change a few complex declarations to _Complex on the big
machine and they even seem compatible with the normal 'complex'
declarations.

The program doesn't use sophisticated complex functions, so there's a
good possibility it'll work.

Anyway, I'll also explore the minGW way, as I would appreciate
stand-alone executables.


Thanks for the info.
John

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: Complex.h file

Richardson, Anthony
John Coppens <john <at> jcoppens dot com> writes:

> Tony Richardson <ar63 <at> evansville.edu> wrote:
>
> >    _Complex double x = 7 + 8i;
> >
> > but it does not have built-in support for all of the complex functions
> > that are declared in complex.h.  I would assume the "problem" is
> > more of newlib issue than a gcc one.
>
> That's good news - I couldn't find much info on the nuts and bolts of the
> complex stuff in gcc-3.4.x (Is there some manual that is up-to-date? The
> gcc manuals I found are from 2002 or older).

The complex number stuff is documented in the gcc info pages.
Look under "C Extensions" and then "Complex Numbers"

> I just tried to change a few complex declarations to _Complex on the big
> machine and they even seem compatible with the normal 'complex'
> declarations.

You might be able to save yourself some typing by using a typedef in
a complex.h file that you create and thereby avoid having to modify the
original source at all.

Regards,
Tony Richardson






--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/