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.
- Ensure that you are using 64-bit Windows 10 version 1607 or later:
- Enable the Developer mode via system settings:
- Open the “Add/Remove programs”, click “Turn windows features on or off” and enable the Windows Subsystem for Linux:
- 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”:
- Start Visual Studio and select File->New Project->VisualGDB->Linux Project Wizard:
- 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:
- On the Computer Selection page select “Use the Windows 10 Linux Subsystem” and proceed with the default toolchain:
- When you press ‘Finish’, VisualGDB will check that the Linux Subsystem on your machine is usable and contains all necessary tools:
- When the project is created, build it via Build->Build Solution:VisualGDB 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.
- 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:
- You can use the VisualGDB Project Properties window to edit various project properties, add references to test frameworks or check advanced IntelliSense settings: