Using Windows 10 Linux Subsystem to develop Linux applications

This tutorial shows how to use the new Windows 10 Linux subsystem (lxss) to develop Linux applications from Visual Studio. The Linux subsystem allows running native Linux applications side-by-side with the Windows processes without installing a separate virtual machine. This improves performance and allows quickly testing out your Linux code without installing a separate operating system.

Before you begin, install VisualGDB 5.2 or later.

  1. Ensure that you are using 64-bit Windows 10 version 1607 or later:00-build
  2. Enable the Developer mode via system settings:01-devmode
  3. Open the “Add/Remove programs”, click “Turn windows features on or off” and enable the Windows Subsystem for Linux:02-lxss
  4. Once the subsystem is installed, open the bash shell from the Start menu and ensure that gcc is installed. If not, you can install it by running “sudo apt-get install gcc”:03-gcc
  5. Start Visual Studio and select File->New Project->VisualGDB->Linux Project Wizard:04-prjname
  6. In this tutorial we will show how to create a basic new project with MSBuild. VisualGDB also supports creating projects with other build systems, importing existing projects and creating unit test projects:05-newproj
  7. On the Computer Selection page select “Use the Windows 10 Linux Subsystem” and proceed with the default toolchain:06-subsys
  8. When you press ‘Finish’, VisualGDB will check that the Linux Subsystem on your machine is usable and contains all necessary tools:07-test
  9. When the project is created, build it via Build->Build Solution:08-buildVisualGDB will automatically convert the Windows project path to the /mnt/<drive>/path form used by the Linux subsystem and will automatically configure IntelliSense to look into Linux include directories under %LOCALAPPDATA%\lxss\rootfs.
  10. Set a breakpoint in main() and hit F5 to begin debugging. VisualGDB will display a warning that it could not set controlling terminal. This is normal and can be safely ignored:09-debug
  11. You can use the VisualGDB Project Properties window to edit various project properties, add references to test frameworks or check advanced IntelliSense settings:10-settings