diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2014-11-19 09:18:54 +0100 |
---|---|---|
committer | Jon Schlueter <jschlueter@navigationsolutions.com> | 2015-01-07 16:28:37 -0500 |
commit | 4b83ce7d7f251398afe8248aa5274ac9a9ec7270 (patch) | |
tree | d6ae2b82d82c7ab5909678e423ac102c04f675a0 /libgps.h | |
parent | 98e9e8bfd346787b8508f4e02b8b1e28564108af (diff) | |
download | gpsd-4b83ce7d7f251398afe8248aa5274ac9a9ec7270.tar.gz |
libgps.h: Fix linkage problem
When building with libQgpsmm=1 enabled I see this failure:
g++ -o libgps_core-qt.os -c -D_GNU_SOURCE -Wextra -Wall -Wno-uninitialized -Wno-missing-field-initializers -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith -Wreturn-type -pthread -Wmissing-declarations -O2 -pthread -fPIC -DUSE_QT -DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtCore libgps_core.c
cc1plus: warning: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++
In file included from libgps_core.c:19:0:
gps_json.h:41:28: error: conflicting declaration of 'int json_ais_read(const char*, char*, size_t, ais_t*, const char**)' with 'C' linkage
/*@null@*/const char **);
^
In file included from libgps_core.c:18:0:
libgps.h:34:12: note: previous declaration with 'C++' linkage
extern int json_ais_read(const char *, char *, size_t, struct ais_t *,
^
scons: *** [libgps_core-qt.os] Error 1
scons: building terminated because of errors.
Digging more into the problem shows, libgps.h doesn't have the
functions enclosed within 'extern "C"' mark. Therefore, g++ mangled
the function names and hence the error.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jon Schlueter <jschlueter@navigationsolutions.com>
Diffstat (limited to 'libgps.h')
-rw-r--r-- | libgps.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -10,6 +10,9 @@ #define SHM_PSEUDO_FD -1 #define DBUS_PSEUDO_FD -2 +#ifdef __cplusplus +extern "C" { +#endif extern int gps_sock_open(/*@null@*/const char *, /*@null@*/const char *, /*@out@*/struct gps_data_t *); extern int gps_sock_close(struct gps_data_t *); @@ -33,6 +36,9 @@ extern int gps_dbus_mainloop(struct gps_data_t *, int, extern int json_ais_read(const char *, char *, size_t, struct ais_t *, /*@null@*/const char **); +#ifdef __cplusplus +} +#endif #define PRIVATE(gpsdata) ((struct privdata_t *)(gpsdata)->privdata) |