• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [OT] calling isnan
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] calling isnan


  • Subject: Re: [OT] calling isnan
  • From: Fred Bacon <email@hidden>
  • Date: Fri, 18 Feb 2005 15:20:29 -0500
  • Organization: Rigid Rotor

On Fri, 2005-02-18 at 11:40 -0800, Chris Espinosa wrote:

> isnan is a macro, so according to the linker, it is undefined.

Chris,

You are correct.  I misspoke with I said the linker was complaining.
Instead, the compiler is complaining about an undefined function isnan.

My current thinking is that the file cmath is the one clobbering the
isnan macro.  That file contains the line

#undef isnan

Here is a short example that shows this happening.

#include <math.h>
#include <iostream>

int
main( int argc, char* argv[] )
{
   double value;
   if ( argc != 2 )
     return 1;

   value = atof( argv[1] );

   if ( isnan (value) )
     std::cout << "Value is not a number." << std::endl;
   else
     std::cout << "Value on command line was: " << value << std::endl;

   return 0;
}


Now if you compile this with the line (I named the file main.cpp,
substitute whatever name you choose.)

 g++ -o goofy -Wall main.cpp -lm

You get the error message

main.cpp: In function `int main(int, char**)':
main.cpp:15: error: `isnan' undeclared (first use this function)
main.cpp:15: error: (Each undeclared identifier is reported only once
for each function it appears in.)


--
=============================================================================
 Fred Bacon                                     email: email@hidden
 Aerodyne Research, Inc.                         http://www.aerodyne.com
 45 Manning Rd                                  Phone: (978) 663-9500 ext 273
 Billerica, MA 01821-3976                         FAX: (978) 663-4918
=============================================================================

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [OT] calling isnan
      • From: Chris Espinosa <email@hidden>
References: 
 >[OT] calling isnan (From: Fred Bacon <email@hidden>)
 >Re: [OT] calling isnan (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: Tracing a Process
  • Next by Date: Data Formatters don't
  • Previous by thread: Re: [OT] calling isnan
  • Next by thread: Re: [OT] calling isnan
  • Index(es):
    • Date
    • Thread