kosma / minmea

a lightweight GPS NMEA 0183 parser library in pure C
Do What The F*ck You Want To Public License
755 stars 246 forks source link

Compiling errors minmea.c #22

Closed ahitrust closed 7 years ago

ahitrust commented 7 years ago

Hello.

I am trying to use this library in a project, but I am running into a wall everytime I try to compile the library, as I am getting this output.

In file included from ./minmea.c:9:0: ./minmea.h:202:86: warning: ‘struct timespec’ declared inside parameter list int minmea_gettime(struct timespec ts, const struct minmea_date date, const struct minmeatime *time); ^ ./minmea.h:202:86: warning: its scope is only this definition or declaration, which is probably not what you want ./minmea.c:587:86: warning: ‘struct timespec’ declared inside parameter list int minmea_gettime(struct timespec ts, const struct minmea_date date, const struct minmeatime *time) ^ ./minmea.c:587:5: error: conflicting types for ‘minmea_gettime’ int minmea_gettime(struct timespec ts, const struct minmea_date date, const struct minmeatime *time) ^ In file included from ./minmea.c:9:0: ./minmea.h:202:5: note: previous declaration of ‘minmea_gettime’ was here int minmea_gettime(struct timespec ts, const struct minmea_date date, const struct minmeatime *time); ^ ./minmea.c: In function ‘minmea_gettime’: ./minmea.c:603:11: error: dereferencing pointer to incomplete type ts->tv_sec = timestamp; ^ ./minmea.c:604:11: error: dereferencing pointer to incomplete type ts->tvnsec = time->microseconds * 1000; ^

I am concerned about the errors, of course. May I get a hand with this? Is this a problem with my compiler/linker or just the library?

phaltness commented 7 years ago

hi. which OS u r using? try compile it with GCC and add LDLIBS = -lcheck -lm -lpthread -lrt to Makefile....

ahitrust commented 7 years ago

I am using debian on a Beaglebone Black (ARM). The library compiles with no problem if I comment the last function in minmea.c "minmea_gettime" (of course, with what that implies). I am compiling the library without using the Makefile (to avoid installing Clang) with gcc -c ./minmea.c -std=c99 -o ./minmea.o. I added the libraries you mentioned in the previous command but it fails with the same output. Maybe it has something to do with timegm() function?

phaltness commented 7 years ago

try to compile it with -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE ...

kosma commented 7 years ago

Closed due to inactivity.