Setting Up Cross-Compilation In Eclipse

1) In Eclipse, open "File" -> "New" -> "C++ Project" in the main menu:

Setting up Eclipse for Rasperry Pi Development - Creating New Project

2) Enter the name of your project (HelloRaspiWorld in this example), choose non-empty template and make sure to specify "Cross GCC" toolchain:

Setting up Eclipse for Rasperry Pi Development - Creating New Project, Project Name and Type

3) Change "Hello World Greeting" and click "Next >":

Setting up Eclipse for Rasperry Pi Development - Creating New Project, Basic Settings

4) Leave project configurations as is (click "Next >"):

Setting up Eclipse for Rasperry Pi Development - Creating New Project, Configurations

5) Set cross-compiler prefix as "arm-linux-gnueabihf-" and cross-compiler path as "C:\rpi-eclipse\rpi-cross-toolchain\arm-linux-gnueabihf".

Setting up Eclipse for Rasperry Pi Development - Creating New Project, Cross-Compiler Path and Prefix

6) Make sure project is created successfully. Right-click on the project name (on the left side):

Setting up Eclipse for Rasperry Pi Development - New Project Created

7) Choose "Properties" in the pop-up menu:

Setting up Eclipse for Rasperry Pi Development - New Project Properties

8) Open "C/C++ Build" -> "Settings" on the left side, then in the "Tool Settings" tab, in the "Cross Settings" screen, make sure Path is "C:\rpi-eclipse\rpi-cross-toolchain\arm-linux-gnueabihf\bin;C:\rpi-eclipse\rpi-cross-toolchain\mingw-make". You may copy and paste it for your convenience (select with mouse, Ctrl+C, Ctrl+V). Click "OK" when done:

Setting up Eclipse for Rasperry Pi Development - Project Properties, Updating Path to Cross-Compiler

9) Click "Project" -> "Build All" (or "Build Project") in the main menu:

Setting up Eclipse for Rasperry Pi Development - Building The Project

10) You may want to check console to make sure there are no errors:

Setting up Eclipse for Rasperry Pi Development - Checking Build Results


>> Read next section