Results are out! Find what you need...fast. Get quick advice or join the chat
Hey there Sign in to join this conversationNew here? Join for free

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

Announcements Posted on
Complete this short survey for a chance to win an iPad mini! 22-09-2014
Got a question about Student Finance? Ask the experts this week on TSR! 14-09-2014
    • Thread Starter
    • 1 follower
    Offline

    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
    • 0 followers
    Offline

    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).
    • 3 followers
    Offline

    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
    • 1 follower
    Offline

    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.
    • 3 followers
    Offline

    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
    • 1 follower
    Offline

    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?
    • 3 followers
    Offline

    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
    • 1 follower
    Offline

    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.

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. By joining you agree to our Ts and Cs, privacy policy and site rules

  2. Slide to join now Processing…

Updated: March 29, 2012
New on TSR

TSR Freshers' blogs 2014

Read what TSR's freshers have to say as they head off to uni

Article updates
Useful resources
Reputation gems:
You get these gems as you gain rep from other members for making good contributions and giving helpful advice.