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:

bcm2835.o

libbcm2835.a

into the folder:

C:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\arm-unknown-linux-gnueabi\sysroot\usr\lib\

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

http://www3.ntu.edu.sg/home/ehchua/programming/howto/EclipseCpp_HowTo.html

 

 

Comments

  1. Kil

    5 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:

    #include

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

    #include “bcm2835.h”

    Both works!

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