Development on the PI

If you want to do broader augmented reality with not only a mobile phone and its camera you might want to look into using a Raspberry PI. Developing and compiling on the PI can be a bit tricky. Here are some steps to ease your life.

I prefer to use an IDE for development. When working on a headless PI installation the way to code would be to write code inside a command line text editor (like nano) and then compile the code using gcc/g++ or similar.

As it turns out there is a way to at least write code on a PC/mac and use an IDE but still develop on the PI.

It is possible by mounting the PI’s file system onto the development machine and by doing so use an IDE that saves the files directly onto the PI.

Mount the PI’s file system

To mount the PI’s file system onto a mac I did the following:

  1. Install Fuse for OSX brew cask install osxfuse
  2. Install sshfs (ssh-fileSystem) which allows us to mount the PI’s file system brew install sshfs
  3. Mount sshfs pi@<<PI-IP-Adress>>: <<target location>> e.g. sshfs pi@ /Users/devbox/sandbox/ Don’t forget the ‘/’ on the end

You can unmount the location with umount <<target location>>

VisualStudio Code (VSC)

I prefer to use VisualStudio Code for most of the development I do. As it turns out that seems to be the perfect combination for developing on/for the PI. I mount the PI’s file system onto my mac and use VSC’s integrated terminal to SSH onto the PI. That way I can compile the source on the PI while still using an IDE for development.

You can open the Terminal with Ctl+`

See this Microsoft plugin for how to use VSC with C/C++


Compiling can then be as easy as:  g++ helloWorld.cpp -o helloWorld . Inside the VSC terminal that is.


Leave a Reply