Starting/Duplicating a Project
As you are about to see, the Eclipse* IDE is a very powerful development tool. This article shows you how to start new projects and set the program properly to support those projects.
The Eclipse IDE is produced by Eclipse: Eclipse
To get started the Intel version of Eclipse IDE for C/C++ developers should be downloaded. Other versions can produce applications, but may be missing Intel® Galileo and Edison-specific elements necessary for deployment.
Creating a New C++ Project
After opening Eclipse IDE, be sure that the C/C++ perspective tab in the upper right corner is selected.
Select File > New and C++ Project as shown in Figure 1.
Figure 1 Choose C++ from File > New.
Give your project a name:
Figure 2 By default, Empty Project and Cross GCC are selected which are fine for our needs.
You can leave the defaults and click Next. Those defaults involve creating an executable type project.
On the Select Configurations screen, the Debug and Release boxes should be checked, so leave as is and click Next:
Figure 3 Debug and Release should be checked, click Next.
On the Cross GCC Command screen enter “i586-poky-linux-“ as the Cross compiler prefix name. No path is necessary during this step (it will be auto detected). Then select Finish.
Figure 4 Enter i586-poky-linux- into the Cross compiler prefix area.
Your project will now appear on the Project Explorer tab.
Now add elements for development on Galileo- and Edison-based IoT devices so that your projects are preset to work appropriately. Right click on your project name, and then open Project Properties -> C/C++ Build -> Settings. Add the following include to Cross GCC Compiler -> Includes:
${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include
Figure 5 To Cross GCC Compiler add: ${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include
Add the following includes to Cross G++ Compiler -> Includes
(note: you can copy and paste from this list):
${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include
${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/c++
${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/c++/i586-poky-linux
${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/c++/bits
${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/mraa
Figure 6 Add the includes to Cross G++ Compiler.
If you have XML, you can import your XML at this time in C/C++ General -> Paths and Symbols:
Figure 7 Click Import Settings and select your XML settings to be used.
On the Tool Chain Editor screen, set current builder to CDT Internal Builder.
Figure 8 Choose CDT Internal Builder from the Current Builder drop down.
Select the level of optimization you want from the drop down within Cross GCC Compiler and Optimization as required:
Figure 9 Select an optimization level if desired.
In the Miscellaneous section in the Cross GCC Compiler section, add ${CFLAGS}, ${CXXFLAGS}, and ${LDFLAGS} in gcc, g++, and cross g++ linker (Figures 10-12):
Figure 10 Under Miscellaneous, add any flags necessary.
And within the Cross G++ Compiler:
Figure 11 Under Miscellaneous, add any flags necessary.
And in the Cross G++ Linker:
Figure 12 Under Miscellaneous, add any flags necessary.
Set your “run as” configuration within the Commands to execute before application section. Note: you’ll have to specify a path / name for your remote executable and make sure the file permissions are set to readable and executable at least for the user. Set permissions by calling “chmod” with the corresponding switches in the “commands to execute before application” section.
Figure 13 Setting chmod in the “Commands to execute before application” section.
Adding custom libraries
At times custom libraries may be necessary for a given project. Custom libraries have to be compiled for target architecture and placed in the devkit-x86\sysroots\i586-poky-linux\usr\lib (binary) and devkit-x86\sysroots\i586-poky-linux\usr\include subfolders of the IDE.
Add your libraries in the “Libraries (-l)” section.
If you choose a custom folder you’ll have to add it to the “Library search path (-L)” section. For a custom include patch, enter its path as shown for the IDE include paths above.
Figure 14 Libraries and search path areas.
Duplicating a Project
When you have tried-and-true run-time parameters, or other settings for an application, it can be easier to copy the application rather than start fresh with a new one. When copying or duplicating a project, it retains all of the settings that were manually created.
Simply right click on the project with the known good parameters and choose copy.
Then right click into the projects pane in an open area and choose paste. A pop-up window will then ask for a new project name.
You now have a new project started using your tried and true run-time parameters.