Creating a C++ Beaglebone app with Visual Studio

This tutorial shows how to create a simple C++ project for the Beaglebone Black board using Visual Studio and VisualGDB 4.1 or later.

  1. Althrough the Beaglebone Black board contains a pre-loaded Linux image in its internal memory, it’s recommended to use an external micro-SD card and program it with the latest image from the Beaglebone site (e.g. using WinFLASHTool):flashWarning! If you are using Debian Stretch or later, you will need to rename the bbb-uEnv.txt file in the SD card to uEnv.txt.  See this tutorial for a detailed explanation.
  2. Connect your Beaglebone Black board to a power source (e.g. via USB) and network. The LEDs will start blinking indicating the system activity:02-beagleboard
  3. Open Visual Studio and begin creating new project with VisualGDB->Linux Project Wizard:03-project
  4. As we are creating the simplest possible application, leave defaults on the first page and click “Next”:04-app
  5. On the next page select “Create a new SSH connection” and enter the hostname of your Beaglebone board. By default Anstrom images use the “root” user with an empty password and Debian images use the “debian” user with “debian” or “temppwd” password:05-root
  6. In this example we will setup our project so that it will be compiled directly on the Beaglebone board. It is slower than using cross-compiler, but simpler to achieve:06-conn
  7. When you press “Next” VisualGDB will ensure that your Beaglebone board contains all the necessary tools to build your project:07-test
  8. At this point we don’t want to change the source disposition settings, so simply press “Finish” on the last page:08-source
  9. VisualGDB will generate a Visual Studio project for you. Build it and see how the source files are transferred to the Beaglebone board and built there using GCC:09-build
  10. Set a breakpoint in main() and press F5 to begin debugging. Once your breakpoint is hit, step over so that the “Hello, World” line is displayed in the output window and hover the mouse over sz to see its value:10-debug
  11. If building projects on Beaglebone is too slow for you, follow this tutorial to setup cross-compilation.