Adding The bcm2835 Library By Mike McCauley

Install the library on a RPi by following the instructions here.

Copy the bcm2835-#.# folder after compiling it onto your windows PC using a USB stick.

Copy the following files:



into the folder:


Add the library to eclipse

In eclipse, right click your project > Properties > C/C++ Build > Settings > Cygwin C++ Linker > Libraries.  Add a new library entry: bcm2835

Copy file bcm2835.h into your project and include it in your source code files that use the IO.

Auto Save Before Build

Window > Preferences > General > Workspace.  Check 'Save automatically before build'.

Compile Warnings Options

Right click project > Properties > C/C++ Build > Settings > Cygwin C++ Compiler > Warnings (also Cygwin C Compiler)

Adding files to project

Just copy them into the projects src folder and they will appear.

Otherwise for files located outside of the project

Right click the projects src folder > Import > General > File System

Turning Off Warnings

Window > Preferences > C/C++ > Code Analysis.  Uncheck warnings you don't want.

Show Line Numbers

Eclipse show line numbers option is in: Menu > preference > general > editors > text editors > show line numbers.

Adding Object Files From Other Libraries

There can be issues with absolute paths when using Cygwin.  They can be resolved by simply replacing all of the c:/ with /cygdrive/c and storing the files in C:\cygwin.

Eclipse Resources



We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


  1. Pingback: Windows Eclipse Programming of the RPi « Raspberry Pi Projects

  2. Kil

    2 years ago

    You can put bcm2835.h file in “C:cygwinoptcrossx-toolsarm-unknown-linux-gnueabiarm-unknown-linux-gnueabisysrootusrinclude” folder and leave the code (the example blink.c code) as:


    If you put bcm2835.h in your src folder, then it should be:

    #include “bcm2835.h”

    Both works!


Your email address will not be published.