Thread: mingw will not let me call isfinite()

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    7

    mingw will not let me call isfinite()

    Hi All,
    I am trying to compile a simple call to isfinite() using the mingw compiler:

    line 750: if(!isfinite(link1IntersectionCoeff))

    where link1IntersectionCoeff is a double.

    I get the error message:
    "ExtendedOrbitFunctionConstMfp.cpp": /David/project/ExtendedOrbitFunctionConstMfp.cpp ` at line 750
    isfinite' undeclared (first use this function)

    However other math.h functions like cos, sin work well.

    Any ideas?
    Thanks,
    David.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Probably this functon is not present in your version of the math-library?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    7
    Is there anything I can do to update it?

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    type gcc -v
    what's the version?
    you could download a newer version, my version of mingw32 has it. (gcc version 3.4.2 (mingw-special))

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    7
    It's gcc-3.2, I will try the new one...

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Also, not to be a pain, but you're compiling .cpp files, so you're probably writing C++ code, and future enquiries should be in the C++ forums if that is the case. If not, you should rename the files to have .c extensions because some compilers might be "smart" about compiling the code as C or C++ depending upon the file extension.

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    isfinite() is a C99 function, which means that you'd need a relatively recent math library to use it, as you've discovered. Like MacGyver said, this means that if this source file is C++, you probably won't be able to use this function.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get RSSI value, send to sensor, sensor receive package, repackage it?
    By techissue2008 in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-04-2009, 10:13 AM
  2. Error C2664 - Trying to call an external Dll
    By jamez05 in forum C++ Programming
    Replies: 3
    Last Post: 08-08-2006, 06:07 AM
  3. Class won't call
    By Aalmaron in forum C++ Programming
    Replies: 3
    Last Post: 04-13-2006, 04:57 PM
  4. Iterative Tree Traversal using a stack
    By BigDaddyDrew in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2003, 05:44 PM
  5. call by reference and a call by value
    By IceCold in forum C Programming
    Replies: 4
    Last Post: 09-08-2001, 05:06 PM