Use Visual C++ for Linux to build and debug C++ code on the Windows Subsystem for Linux

I first learned about Visual C++ for Linux, which was released in March 2016, shortly before the Windows Subsystem for Linux (WSL) was first announced. I was immediately blown away by how VERY cool this feature of Visual Studio is!

What's insanely cool about this feature is that when the project is built, VS opens an SSH channel to a target Linux instance, and uses that channel to copy your C++ project's source code to the target, and builds the code using the native Linux tools. What's more, Visual Studio's debugger can also drive GDB on the target to debug your binary ... while it runs in the target Linux instance!!!

I've been excited to demo VC++ for Linux and WSL working together ever since, but had to wait until we (WSL) wrapped-up some work to make sure our support for SSH, and the required Linux dev tools, was sufficiently solid. Thankfully, the team completed that work during the dev cycle for Windows 10 Creators Update!

For the last couple of weeks we've been working with the awesome Marc Goodner (@RobotDad) and VC++ for Linux team, to design a demo of how to use VC++ for Linux to build, and debug a C++ app, targeting Bash/WSL instead of a Linux VM.

Today (Feb 8th 2017), I was lucky enough to deliver an outline of some of the new stuff coming in Windows Console and WSL, and demo VC++ and WSL during the dev tools segment of the Windows Developer Day virtual conference.

(Bash demo starts at ~0:17:00)

Marc kindly wrote-up a summary of the steps necessary to get this setup on your PC too.

We'll be following up with a more detailed demo and write-up soon, but for now, head over to the VC++ team's blog and give this a try on your own machines! Stay tuned for more cool stuff in this space! 😉


Comments (4)

  1. Evan says:

    Where’s the “coming soon” link for the video?

    1. Ooh! Thanks for the ping! Completely forgot!! 😀

  2. Keto says:

    Hi Rich, I would love even more information on this. What is the latest post for VS with WSL?

    I do wish to ignore bash command line completely and put it in the background while I purely control it from VS. This would work if WSL bash was embedded as a window inside VS such that I can send commands communicating with the WSL I have running in the background.

    For example: I have a makefile which is invoked by “make test” that runs gcc on “main.c” with some arguments and “./main.o”. I wish to be able to do this without ever touching the WSL terminal and invoke this command inside VS.

    Is there a way of doing this today?

    1. Hey @Keto. Sorry for the delay in replying – only just stumbled across your question.

      Marc (https:.// and his team continue to improve Visual C++ for Linux, and have added many improvements in the last year since we filmed this demo. I’d encourage you to reach out to him as he’ll be able to give you all the details.

Skip to main content