Troubleshooting
Problem
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:
- Develop a model in Rational Rhapsody with two classes(class_0 and class_1)
- Add dependency between the classes with stereotype as usage(Implementation)
- Add a separate dependency with friend stereotype
- Generate code for the model and build
![](/support/pages/system/files/support/swg/rattech.nsf/0/2f561f40d9e630c485257a2b00263a06/Content/0.2D0.jpg)
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21599964