IBM Support

How to control the style of include statements in Rational Rhapsody

Technote (FAQ)


Question

How do you control the style of #include statements in IBM Rational Rhapsody?

Cause

Style of #include statements for internal and external elements needs to controlled.

Answer

The style of #include statements in a file can be controlled in Rational Rhapsody by using the property CPP_CG::Dependency::IncludeStyle

This property helps you control the style of a specific dependency, or the entire configuration, component and project.

In order to set the style for include files that are synthesized based on associations between model elements (for example, setting the type of some attribute to a class), you can add a «Usage» dependency between the elements and set this property to the appropriate value.

The possible values are as follows:

  • Default - Use angle brackets for include statements for external elements, and quotes for include statements for other elements.

  • Quotes - Enclose include files in quotation marks.

Example: #include "A.h"


When a compiler encounters an include file in quotes, it searches for the file in both the current directory and the directories specified in the include path. Note that the specific algorithm used is compiler-dependent

  • AngledBrackets - Enclose include files in angle brackets. For example:

Example: #include A.h


When a compiler encounters an include file in angle brackets, it searches for the file only in the directories specified in the include path.

If you set the property to AngledBrackets at the configuration level, you must also change the CG:: File::IncludeScheme property to RelativeToConfiguration to ensure successful compilation

Document information

More support for: Rational Rhapsody
General Information

Software version: 7.5.2, 7.5.2.1, 7.5.3, 7.5.3.1, 7.5.3.2, 7.6, 7.6.0.1, 7.6.1, 7.6.1.1

Operating system(s): Windows

Reference #: 1589210

Modified date: 29 March 2012