You can model the elements manually using the component
model.
Procedure
- Open an existing model or create a new one.
- Add a new component for the external elements
(for example, ExternalComponent).
- Set the scope of the component to Selected
Elements.
- Create a package that contain all the external
elements, and set its CG::Package::UseAsExternal property
to Checked.
Note: This
step is optional; you can also add external elements to existing packages.
- Add the package that contains the external
elements to the scope of the external component. Make sure that the
package is not included in the scope of other components.
- Create an element that is referenced in
the package.
- Provide the following information about
the source files of the external elements:
- Create a hierarchy of packages as needed
for the proper #include path. For example, suppose
you want reference class C, which is defined in C:\MyProjects\Project1\MySubsystem\C.h;
you would create the package MySubsystem.
- Add a file with the necessary name to
the folder and map the external element to it. You do not need to
add this file if the external element has the same name as the file.
- Create a usage dependency to the external
component.
- Add relations to the external elements (for
more information, see External element code access).
Results
In the generated files, the following #include is
generated for the example element:
#include <MySubsystem\C.h>