Creating Qt Projects for Beaglebone with Visual Studio

Warning: This tutorial explains how to create a basic Qt project for the Beaglebone Black board running Angstrom Linux that is deprecated. Follow this tutorial for instructions on cross-compiling Qt5 applications for Beaglebone running Debian.

Before you begin ensure that you have installed VisualGDB 4.1 or later.

  1. First of all you need to install the X11 version of Qt on the Beaglebone device as it is not included in the default image. Connect to the device over SSH (e.g. using SmarTTY) and run the following commands:
    opkg update
    opkg install qt4-x11-free --force-depends
    opkg install libqtcore-dev libqtgui-dev

    You might get some error messages during installation, however in most of the cases the installed Qt libraries will be still usable.

  2. Start Visual Studio and begin creating a new project with the VisualGDB Linux Project Wizard:01-prj
  3. On the first page of the wizard select a Qt-based application:02-qtprj
  4. As compiling the code on the Beaglebone board would take a lot of time, we will use a cross-compiler. Select “Beaglebone” from the toolchain list and specify connection settings for your board:03-board
  5. If you have installed new packages on the board since the last synchronization, click “Synchroinze headers and libraries” to have the latest files from the board copied to the cross-compiler toolchain. VisualGDB will synchronize them automatically:04-sync
  6. Once you click Finish, VisualGDB will test all necessary tools and prepare the toolchain for building your application:05-prepare
  7. The Qt package on Beaglebone is different from other Linux distributions, so VisualGDB will show a message that Qt is not found and offer installing it. Select “no”, as the files you have installed in step 1 are sufficient for building projects with the cross-compiler.06-qtauto
  8. Once your project is generated, you can build it. Visual Studio will show an error indicating that QMainWindow file is not found:07-error
  9. This happens because the Qt for Beaglebone expects certain environment variables pointing to the locations of headers and libraries (see the generated Makefile for details). Right-click on your project in Solution Explorer, select VisualGDB Project Properties, go to the QMake page and add the following variables to the Make command (not the QMake one):
    OE_QMAKE_INCDIR_QT <toolchain>\arm-angstrom-linux-gnueabi\sysroot\usr\include\qt4
    OE_QMAKE_LIBDIR_QT <toolchain>\arm-angstrom-linux-gnueabi\sysroot\usr\lib


  10. Now you can build and debug your project. Press Ctrl-Shift-B to build it and F5 to start debugging. The X11 windows will be forwarded to your Windows machine using XMing:09-messagebox
  11. Finally you can resolve IntelliSense errors by adding the Qt include directories to the IntelliSense Include Directory list in VisualGDB Project Properties:10-intellisense
  12. Once you apply those settings, IntelliSense will work just like for normal Windows projects:11-arghint