Problem with MAVSDK C++ library on <Mocap> and <Info>

Hi guys,
I’m having some problems with the MAVSDK C++ library. Doing
auto mocap = std::make_shared<Mocap>(system);

results in the following error while building:
/usr/include/c++/7/ext/new_allocator.h:136: undefined reference to 'mavsdk::Mocap::Mocap(mavsdk::System&)'

The same is true for <Info>. <Telemetry> and <Action> work fine though.
gcc versions is 7.4.0 (on an amd64 machine running Ubuntu 18.04). MAVSDK version is v0.21.3.

Thanks a lot in advance (:

How have you installed the library?

And what is the CMakeLists.txt file that you’re using to compile this example?

I built the library from source.
The CMakeLists.txt was pretty much the same as the one in the example.

cmake_minimum_required(VERSION 2.8.12)

project(Telemetry)

if(NOT MSVC)
    add_definitions("-std=c++11 -Wall -Wextra -Werror")
else()
    add_definitions("-std=c++11 -WX -W2")
endif()

#include_directories(/usr/local/include)
#link_directories(/usr/local/lib)

find_package(MAVSDK REQUIRED)

add_executable(Telemetry
    Telemetry.cpp
)

target_link_libraries(Telemetry
    MAVSDK::mavsdk_telemetry
    MAVSDK::mavsdk_action
    MAVSDK::mavsdk
)

I’m using Qt with cmake by the way, if that’s of any help.

Ok, you need to add the mocap plugin:

target_link_libraries(Telemetry
    MAVSDK::mavsdk_telemetry
    MAVSDK::mavsdk_action
    MAVSDK::mavsdk_mocap
    MAVSDK::mavsdk
)

Ahh silly me. Thanks a lot @JulianOes.

1 Like