This is an old revision of the document!
Table of Contents
Setting up a complete development environment in C++ for Raspberry PI
Intro
I wanted to do some development for the Raspberry PI. So, my first idea is to use c++ for the task, and use it from my laptop, instead of using the ssh and the oldies development environments.
I prefer to use a decent IDE (Eclipse for C++) for the task, and debug remotely from my
So, the objectives are:
- To develop in C++ for the Raspberry PI
- To do it in eclipse, in my computer
- To compile in my computer, and debug remotely in the Raspberry PI
- Moreover, to use libraries specifically compiled for the raspberry pi (log4cpp, libconfig)
This setting will configure a development environment optimal for develop and create programs in the raspberry pi.
Previous considerations
Previous tasks I did in my raspberry pi:
- Configure other user than pi, and delete the original pi user
- Configure static IP
Install eclipse
First, install the Java Runtime Environment by doing:
# sudo apt-get install openjdk-8-jdk
And then, install the eclipse: I've went to http://www.eclipse.org/downloads/ and located Eclipse CDT (specific for development in C/C++) and install it.
Install the cross compiler
The “good” cross compiler is the one that comes in the Raspberry Pi kernel building instructions: reject other recipes that simply are for other boards/architectures (boards with arithmetic coprocesor, and things like that).
As it says in the webpage, can download it at https://github.com/raspberrypi/tools. I've
downloaded the tools in ~/tools-master. So, because my linux system is 64 bits, the path
for the compiler is in ~/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
.
Create your first project in eclipse
Don't forget the path in the previous step, because you will need to create your first hello world project in eclipse.
Let's go for it: first, open eclipse and click on “File → New → C/C++ Project”: