## Building Projects and Components

In this example we show how to create a new project using one of the built-in Carbide templates, how to build it into an executable, and how to launch the debugger to verify program accuracy. The steps to do this include:

1. Creating a project from a project template
2. Building the object code based on the project sources
3. Defining a launch configuration for running or debugging the application
4. Controlling and debugging the running program using the Carbide debugger

Once you have a project in hand, the next thing to do is compile or build it into object code.

Building projects consists of a sbs or abld-based build system that wraps build functionality around existing SDK build tools that invoke makmake commands (e.g. makmake bldfiles and sbs build).

The plug-ins provide extra functionality to set up suitable build configurations for Symbian C++ projects. The initial selection of a build configuration is done when you create a project, as described in Creating New Projects from Templates. You can later change the Active Build Configuration. The Build Configurations also provides a command (Project > Build All Configurations) to build all the selected build configurations in a batch.

Building Symbian C++ projects can involve the use of Symbian specific tools, such as the Symbian resource compiler. For detailed information on such tools, see the documentation for the SDK that you are using.

You build projects to process the source files that comprise a program and generate object code. The compiler flags syntax errors in the source files. Use the Properties for <project_name> window to control how the project is built. The following methods build a project:

- Build All Configurations (CTRL-ALT-A) — builds all build configurations for a project
- Build Working Set — specify which projects to build in a working set
- Build Project — builds the entire project if it has never been built before or on subsequent builds only those files that have changed since the last build operation

#### Building a project

1. Select the project to build in the Project Explorer view.
2. Build the project using one of these actions:
   - Right-click the project in the Project Explorer view and choose Build Project (see above).
   - Click the Run > Build Project menu option.
   - Click the Build () icon in the toolbar to build the project.

> Choosing any of the above actions causes Carbide to build the selected project. A Build Project dialog (below) and a progress bar appear during a lengthy build operation. All build output is shown in a Console view while build errors and warnings appear in the Problems view.

> Whether a full build or incremental build is requested, Carbide forwards the request to the SDK make system. The SDK make system determines if anything needs to be built. Carbide always checks that makefiles are up-to-date and dependencies present.

> The project is also built if you make a change to it and then click Debug. It may be useful to automatically save modified resources before a manual build process by enabling the Save automatically before build option in the Window > Preferences > General > Workspace preference panel.

> NOTE If you want to turn off building before launching, uncheck the Build (if required) before launching option in the Window > Preferences > Run/Debug > Launching preference panel.

> When performing a build, output is displayed in the Console view. If you do not want to clear the console before each build you need to uncheck the option Always clear console before building in the Console panel. This option is enabled by default. You can access this panel by selecting Window > Preferences > C/C++ > Build > Console preference panel (below).

> Not clearing the console is useful when you are performing multiple builds, such as a regular project build, building a project package (.pkg) file, and building a ROM image. For example, if you do not clear the console before each build, then a subsequent build will not overwrite information from a previous build.

2. Verifying a successful project build

   Once compiling is complete use the Project Explorer, Problems, Console, and Executables views to locate and resolve any problems generated during the build.

   1. Examine the project icon in the Project Explorer view
      - — a successfully built project icon.
      - — projects with warning messages show a yield badge.
      - — projects with error messages show a red badge.
   2. Check the Problems view for error or warning messages

      Examine the Problems view to see what errors and warning messages were generated during the build. The Description column contains additional information about the problem that can help you resolve it.

   3. Examine the Console view for more specific details on an error or warning message

      Use the Console view to see where a specific problem occured during the build.

   4. Examine the Executables view for missing source files

      Use the Executables view to see what source files were used during the build. Sources shown in gray are those Carbide cannot find. Missing sources in an SDK not built on your machine are common, but missing sources that you created can be resolved.

   Once you're resolved all the build errors in a project, its time to link the program to a specific target. This is done with a launch configuration.

#### NEXT STEP > Defining a launch configuration for running or debugging the application

####

#### Other references

- Emulator Application Projects