kosma / minmea

a lightweight GPS NMEA 0183 parser library in pure C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling errors minmea.c

ahitrust opened this issue · comments

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 minmea_time *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 minmea_time *time_)
^
./minmea.c:587:5: error: conflicting types for ‘minmea_gettime’
int minmea_gettime(struct timespec *ts, const struct minmea_date *date, const struct minmea_time *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 minmea_time *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->tv_nsec = 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?

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

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?

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

Closed due to inactivity.