Where to get C header files (complex.h)?

Announcements Posted on
How helpful is our apprenticeship zone? Have your say with our short survey 02-12-2016
    • Thread Starter
    Offline

    2
    ReputationRep:
    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
    Offline

    2
    ReputationRep:
    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).
    Offline

    0
    ReputationRep:
    (Original post by LeeC)
    I'm running some C code through another program
    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.
    • Thread Starter
    Offline

    2
    ReputationRep:
    (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.
    (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).
    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.
    Offline

    0
    ReputationRep:
    (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.
    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.
    • Thread Starter
    Offline

    2
    ReputationRep:
    (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.
    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?
    Offline

    0
    ReputationRep:
    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.

    (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?
    Nope, sorry. See this page - the interpreter compiles something which looks like but isn't actually standard C.
    • Thread Starter
    Offline

    2
    ReputationRep:
    (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.
    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.

    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.
 
 
 
Write a reply… Reply
Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. Oops, you need to agree to our Ts&Cs to register
  2. Slide to join now Processing…

Updated: March 29, 2012
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Today on TSR
Poll
Would you rather have...?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.