Visual Studio for Raspberry Pi/Linux C++ Development

Since Visual Studio 2015 it is possible to develop software in C++ for linux systems.

This is pretty great if you are planning on developing software for a Raspberry Pi.


Create a new project on Visual Studio and choose Visual C++>Cross Platform>Linux.

If you don’t see this option you must download Visual C++ for Linux Development Extension.

  1. Go to Tools>Extensions and Updates…
  2. Select Online, search for “Linux” and you should be presented with the following screen:
  3. Install Visual C++ for Linux Development and you are good to start your first project.


In order to remotely debug you need to install a couple of dependencies on your Raspberry or Linux machine:

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

Check which version of g++ it has been installed because you need >=4.7

g++ --version

In case you have a version older than 4.7, install it:

sudo apt-get install g++-4.7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
sudo update-alternatives --config gcc

Now you’re ready to Debug.

Paste the following code in main.cpp to test the debugger:

#include <cstdio>
#include <stdlib.h>

int main()
	printf("Hello World!\n");
	system("touch ~/Desktop/helloWorld");
	return 0;

Select system("touch ~/Desktop/helloWorld"); line and press F9 (Toggle Breakpoint) in order to stop debugger before running that line.

Choose Debug, ARM and than click in Remote DBG Debbugger button to start debugging:

Since it is the first time you debug, you will be presented with the following window

Just enter your Raspberry Pi IP, user, password and connect.

Using SSH, Visual Studio will upload your project to your Raspberry Pi under ~/projects/ folder and debug it.
Debugger will stop at line 7. Pressing F5 (continue) will create a file named helloWorld on your Raspberry Pi’s Desktop.


Check this Visual C++ Team Blog post. It has a lot of good information about this subject.

Check VisualGDB if you’re planning on using this feature a lot. It might be a great tool to improve your debug.


If Visual Studio is throwing th following error while compiling your software:

“Compiling Desktop applications for the ARM platform is not supported”

Just do the following:

  1. edit file C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\ARM\Platform.Common.props
  2. In the  section add the line:
This entry was posted in C++, Computer Stuff, Programming, Raspberry Pi and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s