IBM Support

Building of model by using Friend stereotype in Rational Rhapsody results in "not allowed outside of a class definition" error

Technote (troubleshooting)


Problem(Abstract)

Attempts to build a model by using the Friend stereotype in IBM Rational Rhapsody results in the error "not allowed outside of a class definition".

Symptom

Attempts to build a model having friend stereotype along with usage(Implementation) stereotype on the same dependency link in Rational Rhapsody results in the following error:


"C2255: 'friend' : not allowed outside of a class definition"

Image

Cause

Incorrect code generation. The friend statement is not being generated in the final code.

Resolving the problem

To resolve this issue, create a separate dependency for the friend stereotype between the two classes to get the error free code by following the steps below:

  1. Develop a model in Rational Rhapsody with two classes(class_0 and class_1)

  2. Add dependency between the classes with stereotype as usage(Implementation)

  3. Add a separate dependency with friend stereotype

  4. Generate code for the model and build


Document information

More support for: Rational Rhapsody
Rational Rhapsody Developer

Software version: 7.5, 7.5.0.1, 7.5.1, 7.5.1.1, 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

Operating system(s): Windows

Reference #: 1599964

Modified date: 06 July 2012