Cross Compiling on Linux for the Edison

Cross compile for Edison

Since I had a couple requests on how to cross-compile C/C++ programs for the Edison, I figured a quick post wouldn’t hurt. Note that I am using Ubuntu 14.04 (64-bit) for this example.

Download “SDK – Cross Compile Tools” from

Unzip and run the installer. Note that the name of the files may change depending on the version of the SDK and your operating system.

Accept all defaults and let the SDK install.

Create a test program with  nano hello.cpp (or your editor of choice) and enter:

Set up the necessary environment variables and compiler with:

Cross-compile the example program with:

Note that we’re using  $CXX to refer to the g++ cross-compiler. Run  echo $CXX to see what’s really going on. Now that we’ve compiled, transfer the executable over to the Edison. I used SCP:

Log in to your Edison (serial terminal, SSH, etc.) and run it!

The information in this post came from this GitHub gist. Go there to see a more in-depth explanation, how to use gcc as well as g++, and set up the cross compile SDK on OSX and Windows.

4 Responses

  1. i have done the same . but my code is not running continuously . code stops as soon as i closed the terminal window .can you please help me out about this .

Leave a Reply