Mavlink library issue

Hi! I’m adding mavlink library (GitHub - mavlink/c_library_v2: Official reference C / C++ library for the v2 protocol) from library toolbar inside vscode. But I have an error on a mavlink.h header file like it is missing.

Funny, same topic as in Include library in main.cpp - #2 by maxg

The library really doesn’t conform to the PlatformIO library structure at all and it doesn’t have a manifest (library.json) to tell PlatformIO its include paths, so… weird things happen.

Also the mavlink.h file exists 12 times in that library, what’s up with that?

1 Like

If you don’t want to change the #include name, you can add the right build path to your build flags in the platformio.ini.

build_flags = 
    -I"$PROJECT_LIBDEPS_DIR/$PIOENV/MAVLink v2 C library/standard"

Replace standard with the folder right folder out of the 12 possible :slight_smile:

2 Likes

As always, thank you for your reply.

The way I understand it, by pointing to or including the mavlink.h file in the respective folder, a specific subset of MAVlink commands will become available.

kinda tricky to release a library in platformio not being built for platformio. Thanx, your build_flags advice worked!