Tutorials, Guides, Tips, and Tricks from Everyday Experiences

The following is a very introductory guide to cross compiling a simple C++ program targeted towards an ARM platform. Development environments differ greatly, but for the most part, they all follow similar steps like outlined below. The very first step is to obtain a cross compile toolchain. CodeSourcery has a free, lite gcc toolchain available for download (as mentioned in a previous post). Once you download an appropriate toolchain for your target, you’ll need to extract it on your development host machine. You’ll notice a directory structure similar to opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu- which is what we’ll use here.
We must make a few other assumptions before beginning: 1.) The cross compiler will be located at ~/crosstool (~ is equivalent to $HOME) and 2.) The program will be located at ~/main.cpp which is also your current working directory (pwd).

01.) Use the following greatest common divisor (gcd.cpp) file as an example if
needed: