Reputation: 159
I'm attempting to compile a client program of gpsd using the following command:
g++ gpsClient.cpp -o gpsClient $(pkg-config --cflags --libs libgps)
The source code begins like that
#include <libgpsmm>
The error is the following:
Package libgpsmm was not found in the pkg-config search path.
Upvotes: 2
Views: 3980
Reputation: 1781
To get data from gpsd
, make sure you have installed libgps-dev
:
sudo apt install libgps-dev
And in case you want to use it in CMakeLists, gps
- and m
-linker flags should be linked to the target:
set(GPS_FLAGS m gps)
#
# other components
#
add_executable([PROJECT_NAME] ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries([PROJECT_NAME] ${GPS_FLAGS})
Upvotes: 1
Reputation: 303
Answering in case someone else encounters this issue.
The proper header file to include is, as suggested in the comments:
#include <libgpsmm.h>
pkg-config should then be able to find the proper search path, assuming gpsd (and/or depending on the OS, libgps-dev or variants thereof) is installed.
There's a good gist on github I use as a base for interacting with gpsd clients in C++ here: example c++ gpsd program using libgpsmm
It even has an example compile command (adapt to clang or other if needed):
g++ -Wall -std=c++17 -pedantic $(pkg-config --cflags --libs libgps) gpsd-example.cpp -o gpsd-example
Upvotes: 3