How to add mavlink library in a Qt project?

1.7k views Asked by At

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.

1

There are 1 answers

1
László Papp On

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.