Having Trouble Installing MAVSDK for Windows

Having trouble building the library onto my windows computer. I have cloned the repository and installed Visual Studio 2019 C++ build tools and Cmake but when I execute
cmake -G “Visual Studio 15 2017” -DBUILD_SHARED_LIBS=ON -Bbuild/default -H.
I get the error:

CMake Error at CMakeLists.txt:3 (project):
Generator

Visual Studio 15 2017

could not find any instance of Visual Studio.

– Configuring incomplete, errors occurred!

I have tried downloading further workloads from Visual Studio (such as MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)), uninstalling and reinstalling everything, and restarting my computer but keep getting the error.

I think for older VS versions you need to add the architecture, e.g.

cmake -G “Visual Studio 15 2017 Win64” -DBUILD_SHARED_LIBS=ON -Bbuild/default -H.

Thank you for the response. However, that command introduced its own error: “Does not match the generator used previously, Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory”. After removing the txt file and directory, I received the original error “could not find any instance of Visual Studio”. See picture below.

Any help would be much appreciated.

Never mind, I just had to install Visual Studio 2017 rather than 2019 and it worked. However, I am now having trouble locally installing the SDK. I am trying to call this command:
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -Bbuild/default -H.
in order to install this into my install folder but I get the following error saying it failed to build:

Someone had the same issue here: https://github.com/mavlink/MAVSDK/issues/800

They resolved it but unfortunately did not say how :frowning:.

Thanks for the link, I actually followed some steps in the thread and got farther than I was. However, I am running into an issue with CURL. This is the code I have run so far:

git clone https://github.com/mavlink/MAVSDK.git
cd MAVSDK
git checkout develop
git submodule update --init --recursive
cmake -G "Visual Studio 15 2017" -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -Bbuild/default -H.)
cmake --build build/default --target install

At first, the cmake -G command produced the error: Could not find a configuration file for package “CURL” that is compatible with requested version " ". So I edited the CMakeLists.txt file and changed find_package(CURL REQUIRED CONFIG) to find_package(CURL REQUIRED Config) and the code ran without error. However, now the final cmake command is producing a large error with curl wrapper objects. I could not snip all of it but I will add a picture below. Any help would be great.


I don’t think that your change (CONFIG -> Config) fixed the error, but just allowed you to go further before the crash.

Can you try a clean build (remove build/default) with the same commands as you mentioned, but with -DBUILD_SHARED_LIBS=OFF?