Building Applications

Start Eclipse and create a Sourcery G++ project by selecting Project from the New submenu of the File menu. Expand the C++ label and select Managed Make C++ Project. (To build a C application, expand the C label instead.) Click the Next button. Give the project the name "hello" and click the Next button. From the Project Type menu select "Executable (Sourcery G++ for ARM SymbianOS)" and click Finish. If you are asked whether or not to open a new perspective, click the Yes button.

Next, select Source File from the New submenu of the File to add a C++ source file to your project. Name the source file hello.cc and click Finish. Paste the following code into the file:

Example 5.1. Hello, World (C++)

#include <iostream>

int main () {
  std::cout << "Hello, world!" << std::endl;
}

As soon as you save the file, Eclipse will build the program. The executable itself will be located in a subdirectory of the Eclipse workspace directory named hello. Of course, the executable will run on the target system, so if you are targeting an embedded system, you will have to upload the executable to the target system before running the application.