Where to get C header files (complex.h)?
From C++ to PHP, debugging to webhosting; help and discussion about writing your latest program to running your website. NOT for help when your PC won't work.
| Announcements | Posted on | |
|---|---|---|
| Please change your TSR password | 23-05-2013 | |
| Enter our travel-writing competition for the chance to win a Nikon 1 J3 camera | 20-05-2013 | |
-
Where to get C header files (complex.h)?
Hi,
I'm relatively new to C, and I need this header file, do you know where I can find it?
I'm running some C code through another program so I'm not using Visual Studio or anything to run my code, although my uni does have Visual Studio. A 'complex' file exists in the Visual Studio directory but it has no extension, so I assume it is some other type of file to do with C++ perhaps..
Thanks,
Lee -
Re: Where to get C header files (complex.h)?
There are two incompatible complex number systems.
<complex> is the C++ template based complex number header file - it requires a C++ compiler and should be part of the MSVC C++ standard includes .
<complex.h> is the C99 facility that adds support for _Complex. It requires a C99 (ISO/IEC 9899:1999)compliant C compiler (but I don't think MS know how to make one). -
Re: Where to get C header files (complex.h)?What is this other program? From briefly flicking through what the standard actually requires of complex.h, it doesn't look like something which can be implemented in the header alone: it requires compiler support for the underlying type. Of course it's still possible to use an alternative library providing for complex arithmetic, but unless this 'other program' supports at least some of C99, you're not just going to be able to use a copy of the standard header.(Original post by LeeC)
I'm running some C code through another program
EDIT: Which is actually what maturestudy said, just in more words.Last edited by TheUnbeliever; 29-03-2012 at 15:42. -
Re: Where to get C header files (complex.h)?(Original post by TheUnbeliever)
What is this other program? From briefly flicking through what the standard actually requires of complex.h, it doesn't look like something which can be implemented in the header alone: it requires compiler support for the underlying type. Of course it's still possible to use an alternative library providing for complex arithmetic, but unless this 'other program' supports at least some of C99, you're not just going to be able to use a copy of the standard header.
EDIT: Which is actually what maturestudy said, just in more words.The other program is Fluent, computational fluid dynamics software by Ansys Inc. I'm assuming it supports C99 (I've tried to find out but to no avail) so I should be fine. But it I just need complex.h so I can try it, seeing as I can't find out if it uses C99 or whatnot.(Original post by maturestudy)
There are two incompatible complex number systems.
<complex> is the C++ template based complex number header file - it requires a C++ compiler and should be part of the MSVC C++ standard includes .
<complex.h> is the C99 facility that adds support for _Complex. It requires a C99 (ISO/IEC 9899:1999)compliant C compiler (but I don't think MS know how to make one). -
Re: Where to get C header files (complex.h)?It looks to me like ANSYS FLUENT uses the system compiler, which is likely to be MSVC if you're on Windows. MSVC is not C99-compliant and likely never will be.(Original post by LeeC)
The other program is Fluent, computational fluid dynamics software by Ansys Inc. I'm assuming it supports C99 (I've tried to find out but to no avail) so I should be fine. But it I just need complex.h so I can try it, seeing as I can't find out if it uses C99 or whatnot.
In any case, there's absolutely no guarantee that you could take a complex.h header intended to be used with one toolchain and use it with another. Because it relies on compiler support, it's likely to rely on implementation-specific names. e.g. For example, see "#ifdef __GNUC__" in this OpenBSD copy.Last edited by TheUnbeliever; 29-03-2012 at 16:51. Reason: Added a second link to back up 'system compiler' claim. -
Re: Where to get C header files (complex.h)?Ok, I'm quickly getting out of my depth here. In fluent you can use Complied or Interpreted code for UDFs (user defined functions), at the moment I'm using an interpreted UDF, does this change the likelihood of this working or not?(Original post by TheUnbeliever)
It looks to me like ANSYS FLUENT uses the system compiler, which is likely to be MSVC if you're on Windows. MSVC is not C99-compliant and likely never will be.
In any case, there's absolutely no guarantee that you could take a complex.h header intended to be used with one toolchain and use it with another. Because it relies on compiler support, it's likely to rely on implementation-specific names. e.g. For example, see "#ifdef __GNUC__" in this OpenBSD copy. -
Re: Where to get C header files (complex.h)?
To move in a more useful direction: it is possible to set up alternative toolchains like GCC or Clang under Windows. It's not a two-second exercise, but it may still be quicker than rewriting to use an external library if your code isn't tiny. You will probably need to crib together your own makefile from the ones provided with FLUENT if you took this route.
Nope, sorry. See this page - the interpreter compiles something which looks like but isn't actually standard C.(Original post by LeeC)
Ok, I'm quickly getting out of my depth here. In fluent you can use Complied or Interpreted code for UDFs (user defined functions), at the moment I'm using an interpreted UDF, does this change the likelihood of this working or not?Last edited by TheUnbeliever; 29-03-2012 at 17:07. -
Re: Where to get C header files (complex.h)?Well thanks A LOT for your help, I haven't fully understood all of what you have said but at least I understand that this isn't going to be a trivial thing. Also I'm using this on Uni computers and don't have access to a lot of the folders I need to anyway which is a bummer.(Original post by TheUnbeliever)
To move in a more useful direction: it is possible to set up alternative toolchains like GCC or Clang under Windows. It's not a two-second exercise, but it may still be quicker than rewriting to use an external library if your code isn't tiny. You will probably need to crib together your own makefile from the ones provided with FLUENT if you took this route.
Nope, sorry. See this page - the interpreter compiles something which looks like but isn't actually standard C.
It's possible to code in Fortran then 'link' it or something like that so that the complier understands it, I will go into that route seeing as I have the code in Fortran anyway.