< Previous | Next >

Lesson 6: Generating code

In this lesson, you learn how to generate code from your model and view the results in the output window.
In most environments, before you generate code, you need to set an active configuration. The Rational® Rhapsody® code generator automatically checks for inconsistencies that might cause problems in generating or compiling the code. Some of the checks performed by the checker detect potentially unrecoverable conditions that might cause code generation to stop processing if not corrected before generating code.

To set the active configuration:

  1. In the model browser, expand the VehicleSensor project.
  2. From the Rational Rhapsody main menu, select Code > Generate > HostConfigDebug.
  3. The Log tab lists the generated files and shows a status message. If no errors are found, you get the following message:
  4. From the Rational Rhapsody main menu, select View > Active Code View.
  5. In the model browser, expand the Design package.
  6. Click the button class.
You can see the header and code files for the button class are shown in the output window:
Output window showing header and code files for the button class.

Lesson checkpoint

In this lesson, you learned how to:
  • Generate code.
  • Locate code in the Code View window.
< Previous | Next >

Feedback