Skip to content

CPP Code Generation

Ábel Hegedüs edited this page Jul 30, 2015 · 15 revisions

Usage

Note: If you are generating CPP code from the UML model, the model elements should be in a component, because the code generation runs only on components.

From Papyrus

  1. Open your UML model in Papyrus
  2. Right click on the root item (the model) in the Model Explorer view and select Generate CPP code for selected UML model

From xtuml editor

  1. Use the UML-Integration to generate xtUMLrt model from UML
  2. Open the xtUMLrt model (with Sample Reflective Ecore Editor)
  3. Right click on any XTComponent and select Generate CPP code for selected XTComponent

C++ settings on Windows

If you use Windows you need some extra settings to run C++ code:

  1. Open project's Properties and under C/C++ Build in the Tool Chain Editor setup the Current toolchain to Cygwin GCC.
  2. Open run configuration and add PATH as an environment variable if it does not exist (if you have CUTE for testing you can copy this variable from the test configuration).
  3. If you need to use the built project you also need to set dll instead of so as an Artifact extension (Project Properties → C/C++ Build → Settings → Build Artifact).

Example models

You can find a simple example that contains a single TEST class here.
You can find the PingPong example model here.
You can find more example models here.

Clone this wiki locally