无法使用g ++编译libgpsmm GPSD c ++包装器

问题描述 投票:0回答:1

我是一位非常精通C ++的新手,我肯定有一个明显的错误,但是我无法在任何地方找到问题的答案。

我正在尝试编译在这里找到的示例c ++脚本:https://gist.github.com/elimpnick/8313815ac387e6757f751dc8960f03d7 with g ++

我遵循了给定的g ++命令:

g++ -Wall -std=c++14 -pedantic $(pkg-config --cflags --libs libgps) example_gps.cpp -o gpsd-example

但是收到此错误:

/tmp/ccntoIZP.o: In function `main':
example_gps.cpp:(.text+0x48): undefined reference to `gpsmm::stream(int)'
example_gps.cpp:(.text+0x88): undefined reference to `gpsmm::waiting(int)'
example_gps.cpp:(.text+0xa4): undefined reference to `gpsmm::read()'
example_gps.cpp:(.text+0xe4): undefined reference to `gpsmm::read()'
example_gps.cpp:(.text+0x270): undefined reference to `gpsmm::~gpsmm()'
example_gps.cpp:(.text+0x2c0): undefined reference to `gpsmm::~gpsmm()'
/tmp/ccntoIZP.o: In function `gpsmm::gpsmm(char const*, char const*)':
example_gps.cpp:(.text._ZN5gpsmmC2EPKcS1_[_ZN5gpsmmC5EPKcS1_]+0x14): undefined reference to `vtable for gpsmm'
example_gps.cpp:(.text._ZN5gpsmmC2EPKcS1_[_ZN5gpsmmC5EPKcS1_]+0x18): undefined reference to `vtable for gpsmm'
example_gps.cpp:(.text._ZN5gpsmmC2EPKcS1_[_ZN5gpsmmC5EPKcS1_]+0x5c): undefined reference to `gpsmm::gps_inner_open(char const*, char const*)' 

指示(我想)未正确链接到libgps库。

但是,我可以使用dpkg找到该库,并使用dpkg -L找到该位置:

ls /usr/lib/aarch64-linux-gnu/ | grep libgps
libgps.a
libgps.so
libgps.so.23
libgps.so.23.0.0 

并且已经尝试过此:g++ -Wall -std=c++14 -pedantic -L/usr/lib/aarch64-linux-gnu/ -lgps example_gps.cpp -o gpsd-example

给出相同的错误。 Gpsd和libgps-dev一样安装,cgps在/ dev / ttyACM0处显示了来自我的gps的3D修复程序。

我正在Ubuntu 18.04上使用Jetson Nano Production Module,如果有什么区别。我的代码与上面链接中提供的代码相同(但文件名略有不同)。我尝试删除libgps.so文件,仅保留libgps.so,但没有成功,无法卸载/重新安装等。libgpsmm.h和gps.h都位于/ usr / include中。

我没有主意。有人可以指出我正确的方向还是让我摆脱痛苦!

谢谢。

c++ c g++ ubuntu-18.04 gpsd
1个回答
0
投票

Ted Lyngmo-是的,它们属于同一个库。

https://gitlab.com/gpsd/gpsd/-/blob/master/libgpsmm.cpp

至少不会在本地安装libgpsmm对象,只有安装了GPSd 3.20的Raspberry Pi Buster或Mac OS X上的.h文件才可以安装

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.