Now that the project is created and set up, it's time to build it. There are some deliberate errors in the program that we need to correct; doing that is the next step in this tutorial.
The first thing to do is set the active build configuration you want to use:
This means we are going to use a build configuration that generates code with debug information and no optimization, so it can be debugged. If we wanted to produce production code with no debug information and optimization enabled, we could use the AVR Release configuration. However, because we are going to use the debugger, we shall use the AVR Debug configuration.
To build the project:
Alternatively, to build the Tutorial project using a shortcut menu:
CrossStudio starts compiling the project files, but stops after detecting an error. The Output window shows the Transcript, which contains the errors found in the project:
The file main.c contains two errors. After compilation, CrossStudio moves the cursor to the line containing the first reported error and displays an error message in the Output window. (You can change this behavior by modifying the Text Editor > Editing Options > Enable Popup Diagnostics environment option using the Tools > Options dialog.)
To correct the error, change the return type of factorial from void to int in its prototype.
To move the cursor to the line containing the next error, type F4 or choose Search > Next Location. The cursor is now positioned at the debug_printf statement, which is missing a terminating semicolon—add the semicolon to the end of the line. Using F4 again reveals that we have corrected all errors.
Pressing F4 again wraps around and moves the cursor to the first error, and you can use Shift+F4 or Search > Previous Location to move back through errors. Now that the errors are corrected, build the project again by pressing F7. The Transcript shows there still is a problem.
The remaining error is a linkage error. Double-click fact.c in the Project Explorer to open it for editing and change the two occurrences of fact to factorial. Rebuild the project—this time, the project compiles correctly:
A summary of the memory used by the project is displayed at the end of the build log. The results for your application may be different, so don't worry if they don't match.
In the next sections, we'll explore the characteristics of the newly built project.