gpsd-users
[Top][All Lists]
Advanced

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

Re: Program fails to compile after 3.20 upgrade


From: David J Taylor
Subject: Re: Program fails to compile after 3.20 upgrade
Date: Fri, 22 May 2020 14:59:18 +0100

From: Charles Curley
[]
Right, the API changed a while ago. gps_read() now takes three
parameters.

To keep backward compatibility, you might use conditional compilation:

#if GPSD_API_MAJOR_VERSION >= 7
/* from <gps_json.h> */
#define GPS_JSON_RESPONSE_MAX   4096

bool showMessage = false;
char gpsdMessage[GPS_JSON_RESPONSE_MAX];
size_t gpsdMessageLen = 0;
#endif

...

#if GPSD_API_MAJOR_VERSION >= 7 /* API change. */
       if (gps_read (&gpsdata, gpsdMessage, gpsdMessageLen) == -1) {
#else
       if (gps_read (&gpsdata) == -1) {
#endif

If you don't care about the message, you can use NULL and 0 with
appropriate casts instead. gpsd will then ignore them.

I hope that helps.
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/
======================================================

Many thanks, Charles.

I've made the updates you suggested (not used conditional compilation before) and it works nicely!

Cheers,
David
--
SatSignal Software - Quality software for you
Web: https://www.satsignal.eu
Email: address@hidden
Twitter: @gm8arv


reply via email to

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