{"id":805,"date":"2017-02-08T12:45:07","date_gmt":"2017-02-08T20:45:07","guid":{"rendered":"http:\/\/blogs.msdn.microsoft.com\/commandline\/?p=805"},"modified":"2019-02-25T22:08:46","modified_gmt":"2019-02-26T06:08:46","slug":"use-visual-c-for-linux-to-build-and-debug-c-code-on-the-windows-subsystem-for-linux","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/commandline\/use-visual-c-for-linux-to-build-and-debug-c-code-on-the-windows-subsystem-for-linux\/","title":{"rendered":"Use Visual C++ for Linux to build and debug C++ code on the Windows Subsystem for Linux"},"content":{"rendered":"<p>I first learned about <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/03\/30\/visual-c-for-linux-development\/\">Visual\u00a0C++ for Linux, which was released in March 2016<\/a>, 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!<\/p>\n<p>What&#8217;s insanely cool about this feature is that when the project is built, VS opens an SSH channel to a\u00a0target Linux instance, and uses that channel to copy your C++ project&#8217;s source code to the target, and builds the code using the native Linux\u00a0tools. What&#8217;s more, Visual Studio&#8217;s debugger can also drive GDB on the target to debug your binary &#8230; while it runs in\u00a0the target Linux instance!!!<\/p>\n<p>I&#8217;ve been excited to demo VC++ for Linux and WSL working together ever since, but\u00a0had 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!<\/p>\n<p>For the last couple of weeks we&#8217;ve been working with the awesome Marc Goodner (<a href=\"https:\/\/twitter.com\/robotdad\">@RobotDad<\/a>) and VC++ for Linux team, to\u00a0design a demo of how to use VC++ for Linux to build, and debug a C++ app,\u00a0targeting Bash\/WSL instead of a Linux VM.<\/p>\n<p>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\u00a0VC++ and WSL during the dev tools segment of the Windows Developer Day virtual conference.<\/p>\n<p>(Bash demo starts at ~0:17:00)<\/p>\n<p>Marc kindly wrote-up <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2017\/02\/08\/targeting-windows-subsystem-for-linux-from-visual-studio\">a summary of the steps necessary to get this setup on your PC too<\/a>.<\/p>\n<p>We&#8217;ll be following up\u00a0with a more detailed\u00a0demo and write-up soon, but for now, head over to the VC++ team&#8217;s blog\u00a0and give this a try on your own machines! Stay tuned for more cool stuff in this\u00a0space! \ud83d\ude09<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I first learned about Visual\u00a0C++ 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&#8217;s insanely cool about this feature is that when the project is built, VS opens an [&hellip;]<\/p>\n","protected":false},"author":910,"featured_media":4545,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[10,1,6,9],"tags":[22,31,42,66,72],"class_list":["post-805","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cmd","category-commandline","category-windows-console","category-bash-on-ubuntu-on-windows","tag-bash","tag-console","tag-linux","tag-visual-studio","tag-wsl"],"acf":[],"blog_post_summary":"<p>I first learned about Visual\u00a0C++ 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&#8217;s insanely cool about this feature is that when the project is built, VS opens an [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts\/805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/users\/910"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/comments?post=805"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts\/805\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/media\/4545"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/media?parent=805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/categories?post=805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/tags?post=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}