IBM Support

How to control order of include statements in Rational Rhapsody

Question & Answer


Question

How do you control order of include statements in IBM Rational Rhapsody?

Cause

You would like to control the order of include statements:

//File b.h containg the typedef

typedef Uint8 unsigned Char

//File a.h

Uint8 var1;

Rational Rhapsody arranges the dependencies in alphabetical order in class1

//File class1.h

#include "a.h"
#include "b.h"

Now when compiler compiles it will say Uint8 is unknown. So you reorder #include it will compile file

//File class1.h

#include "b.h"
#include "a.h"

Answer

To re-order the sequence of include statements in Rational Rhapsody the best way to force order of include statements is by changing the order in the code itself.

After Roundtrip the information regarding the order is stored in the model and in next Code Generation the order is preserved. There is no need to manually deal with that again.

This would work when the value of the property CPP_Roundtrip::General::RoundtripScheme is set to Respect.

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"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;7.6.1.2;8.0;8.0.1;8.0.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21601109