Scott Hanselman

Visual C++ for Linux and Raspberry Pi Development

April 06, 2016 Comment on this post [8] Posted in Open Source | VS2015
Sponsored By

It's bananas over at Microsoft. Last week they announced you can run Bash on Ubuntu on Windows 10, and now I'm seeing I missed an announcement of an extension to Visual Studio that enables Visual C++ for Linux Development.

With this extension you can author C++ code for Linux servers, desktops and devices. You can manage your connections to these machines from within VS. VS will automatically copy and remote build your sources and can launch your application with the debugger. Their project system supports targeting specific architectures, including ARM which means Raspberry Pi, folks.

ASIDE: I also noticed there's a C/C++ extension for Visual Studio Code also. I need to add that to my list of stuff to check out, it looks pretty compelling as well.

Once Visual C++ for Linux Development is installed, you go and File New Project like this. Cool to see Linux in that list along with a Raspberry Pi project.

File New | Linux App

You can pick x86, x64, and ARM, and you can see Remote GDB Debugger is an option.

Remote GDB Debugger

Here I'm running Ubuntu in a VM and connecting to it over SSH from Visual Studio. I needed to set up a few things first on the Ubuntu machine

sudo apt-get install openssh-server g++ gdb gdbserver

Once that was setup, connecting to the remote Linux machine was pretty straightforward as VS is using SSH.

Debugging C++ apps remotely talking to a Linux VM

Pretty cool.

NOTE: Today this cool extension has nothing to do with the Bash on Ubuntu on Windows announcement or that subsystem.  The obvious next question is "can I use this without a VM and talk to gdb on the local Linux subsystem?" From what I can tell, no, but I'm still trying to get SSH and GDB working locally. It's theoretically possible but I'm not sure if it's also insane. Both teams are talking, but again, this feature isn't related to the other.

This extension feels a little beta to me but it does a good job providing the framework for talking to Linux from VS. The team looks to be very serious and even has a cool demo where they code and debug a Linux desktop app.

If you're looking for a another full featured solution for Linux and Embedded Systems development with Visual Studio, be sure to download and check out VisualGDB, it's amazing.


Sponsor: Quality instrumentation is critical for modern applications. Seq helps .NET teams make sense of complex, asynchronous, and distributed apps on-premises or in the cloud. Learn more about structured logging and try Seq free for 30 days at https://getseq.net.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
April 06, 2016 12:53
So it uses the remote g++ compiler to do the build. I like the idea of using visual studio to compile all the things!
April 06, 2016 13:39
Tantalizingly close to VS being a great Linux dev environment. Yeah, the home run is to use VS to build and debug ELF binaries using Bash on W10. Even now, can't we do a Post Build event to shell out to bash to do a g++ compile? That alone would be a major convenience. Looking down the road, another major convenience would a VC++ that produces an ELF binary (love Rosyln) so one source code, one IDE, one compiler works for Windows/Linux/Android.
April 06, 2016 18:43
Why does the extension require me to install Java and an Android SDK if the remote system being targeted has none of that?
April 06, 2016 21:17
@CrashOverride Maybe @AcidBurn could help you find the answer
April 06, 2016 22:33
Nice post, thanks. I'm the PM working on this. Yes we're working with the bash folks here but nothing to say about that just yet.

@CrashOverride, it's because we use a component that is part of the Android Tools called the MIEngine that provides the bridge from the VS debugger to GDB. We are actively working on packaging that dependency as part of our install to remove the dependency. This was the quickest way to get it to people for feedback.



April 07, 2016 14:02
@Marc Goodner, God's speed.
April 08, 2016 11:21
@Howard - or all of MS efforts in the last year or 2 could just show off how closed off and bad Google and Apple are now in comparison. Where is Siri, Google Now, Safari, YouTube apps etc.. for Windows (desktop and mobile)?

Where is .NET framework, Office, SQL Server, Cortana oh that's right Windows, Mac, Linux either now or within the next year.

Want to compile a iOS app, gotta have a mac - errr why? it's intel just like my PC, oh wait cause Apple.

April 08, 2016 15:44
Great post.

How to reference external libraries?

Thanks

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.