With Visual Studio 2019 you can build and debug C++ projects on a remote Linux system or the Windows Subsystem for Linux (WSL). You can get started with Linux development in Visual Studio using MSBuild-based Linux projects or our native support for CMake. CMake lets you use the same source code and build scripts to target multiple platforms and is our recommendation for anything cross-platform or with an eye to open-sourcing. This blog post covers recent improvements to our Linux support in Visual Studio, including:

  • Support for Ninja on Linux. Ninja is a build system with a focus on speed. Ninja has been the default generator (underlying build system) for CMake configurations targeting Windows for some time, but in Visual Studio 2019 version 16.6 Preview 3 we added support for Ninja on LinuxNinja is typically faster than Unix Makefiles and is now the default generator for new CMake configurations targeting a remote system or WSL.
  • First-class support for gdbserver. Gdbserver is a program that allows you to remotely debug applications running on Linux. It is especially useful in embedded scenarios where your target system may not have the resources to run gdb. In Visual Studio 2019 version 16.7 Preview 1 we added a new debugger configuration to debug CMake projects with gdbserver on remote systems. This eliminates the need for manual configuration of launch.vs.json as described in our previous blog post: Debugging Linux CMake Projects with gdbserver.
  • Improvements to the Connection Manager. The Connection Manager in Visual Studio allows you to manage and store secure SSH connections to remote systems. We hear your feedback, and in Visual Studio 2019 version 16.7 Preview 2 you can **edit and set default remote connections in the Connection Manager. **This will allow you to edit an existing connection (e.g. if the IP address of your target device changed) and set default remote connections to be consumed in CMakeSettings.json and launch.vs.json via ${defaultRemoteMachineName} in CMake projects.

More details on all these new features are listed below.

Improved build times with Ninja on Linux

Ninja is a build system with a focus on speed. In Visual Studio 2019 version 16.6 Preview 3 we added support for building CMake projects with Ninja on remote Linux systems and WSL.

Ninja is typically faster than Unix Makefiles and is now the default generator for new CMake configurations targeting a remote system or WSL. You can install ninja on Debian-based Linux systems with the following commands:

sudo apt-get update

sudo apt-get install ninja-build

#cmake #linux #c++ #programming-c #cplusplus

Build and debug C++ projects on a remote Linux system
13.30 GEEK