MAVSDK issues building examples

#1

I am having issues building the examples given with the MAVSDK. I have been through all of the steps and everything seems to work okay up until I try to actually build the example.

When I run cmake … -G “Visual Studio 15 2017 Win64” it generates the make files, but when I run cmake --build . I get multiple errors saying fatal error: 17 unresolved externals. I’m not sure where this issue is coming from or what is causing it.

EDIT: As a side note, I did have to add the line set(CMAKE_PREFIX_PATH “C:/path_to/MAVSDK/install/lib/cmake;${CMAKE_MODULE_PATH}”) to my cmake file to be able to generate the make files.

#2

UPDATE: So I followed the instructions located here

(https://mavsdk.mavlink.io/develop/en/guide/toolchain.html)

for building a C++ app. I ensured the my install folder was in the same location as specified on the webpage and updated the CMakeLists.txt file to include the takeoff_and_land example program. I then copied over the takeoff_land.cpp file from the example so that it was in the same directory as the SDK just like the webpage says. When I try to build this (cmake --build .) I get the error cannot open include file: ‘mavsdk/mavsdk.h’ no such file or directory found.

I then proceeded to update the CMakeLists.txt file to say
include directories(${CMAKE_SOURCE_DIR}/…/MAVSDK/build/default/install/include) which I believe is the correct path to this folder. When I try to build this the build finds ‘mavsdk/mavsdk.h’ but I get a new error cannot open include file: ‘plugin_base.h’: no such file or directory found.

I do not understand why this file is not found since it appears to be in the same directory as the mavsdk.h file.

#3

Does anyone have any ideas as to what my problems are with building a new C++ app? I don’t have a lot of experience with cmake, but it’s frustrating how I can’t seem to get it to include all of the directories I need it to. Is there possibly an issue with the CMakeLists.txt file located at this webpage?

https://mavsdk.mavlink.io/develop/en/guide/toolchain.html

Any help would be appreciated.