I am making a Qt project based on QGroundControl
which uses mavlink library. I googled it but not able to find the correct way. It can not be added as other libraries as it is a header only library. Please someone tell me the correct way to do it.
-
_'it is a header only library'_ Just include the headers then?? – πάντα ῥεῖ Jun 04 '14 at 11:15
-
Was not that enough described here -- https://github.com/mavlink/qgroundcontrol#build-on-linux (for building for Linux)? Have you tried? – NG_ Jun 04 '14 at 11:39
1 Answers
Well, first of all, this is not just a header-only library, so you will need to link against it either through direct LIBS
usage or pkg-config if you get such a thing. In the former case, you may also need to adjust the INCLUDEPATH
variable.
Then, in the source code you just do the regular include:
#include <mavlink.h>
But that is probably not what you want, I think. You want to deal with QGroundControl in your project as that is your direct dependency. They do not seem to ship a .prf
file though, so CONFIG+=x
will not work.
However, if you install it properly, you may not even need to adjust the LIBS
and INCLUDEPATH
variables. In worst case, you have to. I think that is pretty much about it. You could also use pkg-config to deal with it as they seem to ship a .pc
file.

- 51,870
- 39
- 111
- 135
-
corrected myself. I just have to give the header file path in includepath in .pro file btw thanks for answering – panand Jun 09 '14 at 06:43