maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   maemo-sdk: error: 'NAN'/'INFINITY' undeclared (https://talk.maemo.org/showthread.php?t=72287)

AapoRantalainen 2011-04-18 12:58

maemo-sdk: error: 'NAN'/'INFINITY' undeclared
 
When compiling code on scratchbox2 I got
error: 'NAN' undeclared
and
error: 'INFINITY' undeclared

I made simple test case, and it seems there are no defined NAN or INFINITY.

Same code complies under Ubuntu. I checked math.h and nan.h.

Code:

diff -u /usr/include/math.h ~/.maemo-sdk/rootstraps/armel/fremantle5.0minimal_armel/usr/include/math.h
diff -u /usr/include/bits/nan.h ~/.maemo-sdk/rootstraps/armel/fremantle5.0minimal_armel/usr/include/bits/nan.h

nan.h is identical. math.h differs on comments.



Code with workaround. Why this workaround is needed?
Code:

#include <math.h>

//Workaround:
#ifndef NAN
#define NAN (0.0/0.0)
#endif

//Workaround:
#ifndef INFINITY
#define INFINITY (1.0/0.0)
#endif

int main() {
  printf("NAN: %f\n",NAN);
  printf("INFINITY: %f\n",INFINITY);
  return 0;
}



All times are GMT. The time now is 20:21.

vBulletin® Version 3.8.8