gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-users] Error while compiling NAN undeclared in gpsdclient.c


From: Bas van Duijnhoven
Subject: Re: [gpsd-users] Error while compiling NAN undeclared in gpsdclient.c
Date: Wed, 02 May 2012 21:49:36 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

Hello Gary and all other readers of this thread,

I'm glad to say that i've fixed the compilation error (NAN not defined).
Not by changing the #DEFINE in nan.h but by changing the source code of gpsdclient.c.

I changed line 323 in gpsdclient.c from
        heading = NAN;
to
        heading = nan("");

This change to using a C99 function instead of a define is in my opinion a bit more elegant.
But im not exactly sure if the behaviour is still ok.
In any case the result is a error free compiled gspd.

Can anyone verify the change, of give me some pointers as to test this change?

Greetings
Bas


Op 1-5-2012 23:31, Gary E. Miller schreef:
Yo Bas!

On Tue, 01 May 2012 23:07:13 +0200
Bas van Duijnhoven<address@hidden>  wrote:

Just a short answer (i'm on my way to bed :)).
your tip worked excellent:
Every file that uses nan.h gives a warning that it is using case 1:

================================
#if __GNUC_PREREQ(3,3)

# define NAN    (__builtin_nanf (""))
#warning "case 1"
================================
Interesting.

I'm no C-expert but it seems to me that NAN is defined by a builtin
function __builtin_nanf("")
I checked the GCC documentation on this function:
http://gcc.gnu.org/onlinedocs/gcc-4.2.3/gcc/Other-Builtins.html
This function is also supported in the ARM GCC compiler:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/BABICCBA.html
Looks like it shuold work.  You might try to force case 2, which be just
as good, just to see if you can get a good compile out of it.

Your next step might be to ask in the ARM work about this.

Next i checked the version of GCC:
=================================
gcc -v
Looks good to me.  You must have the as and ld somehere since you can build
binaries.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
        address@hidden  Tel:+1(541)382-8588




reply via email to

[Prev in Thread] Current Thread [Next in Thread]