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

Rich Turner

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! 😉

 

0 comments

Discussion is closed.

Feedback usabilla icon