Setup Eclipse for cross-compiling

After you have successfully created your cross-compiling toolchain with crosstool-ng as described in Cross compiling kernel for Raspberry Pi on Fedora 17 you probably want to use the tools not only form command line but also from a rich IDE like Eclipse.

Install Eclipse IDE for C/C++ Developers
Navigate to Eclipse download page and download the Eclipse IDE for C/C++ Developers and extract it. This post is based on the Juno version of Eclipse for 64bit Linux platforms, but probably with slight modification you can apply it for later versions as well.

Optional step: After the Eclipse has been downloaded and extracted you can create a desktop icon for it if you wish:

gnome-desktop-item-edit ~/Desktop/eclipse_cpp.desktop --create-new

Create a C or C++ Project
Start Eclipse and create a new C Project from New menu (description shall work also for C++). On the first dialogue screen, please select the “Hello World ANSI C Project” with “Cross GCC” Toolchains and press the Next button, the settings on the following dialogues can remain as default. On the last dialogue called “Cross GCC Command”, please select the Cross compiler prefix and also the Toolchain Path as shown in the screenshot below.

Verifying the projects
After you have successfully executed the above steps your projects can be compiled on your desktop and executed on the target machine. Eclipse will load all required libraries and tools from the above defined Toolchain path. You can double-check your Eclipse project as shown in the screenshot:

Eclipse with with multiple cross compile projects

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: