.. _example_generation: Example Applications ==================== The RTI *Code Generator* (*rtiddsgen*) can generate example applications from an IDL file, as shown in :ref:`section-helloworld-pubsub`. The last type in the IDL is used as the data-type to publish. Refer to :ref:`section-generating-examples` for instructions on how to build these examples. |me| also provides some buildable applications in the installation directory, as described in :ref:`section-provided-examples`. .. _section-generating-examples: Generating examples ------------------- .. note:: Before running *rtiddsgen*, you might need to add ``rti_connext_dds-/rtiddsgen/scripts`` to your path environment variable folder. Default example ............... To generate an example, run the following command: .. code-block:: console rtiddsgen -example -language [-namespace] This generates an example using the default example template, which uses the Dynamic Participant Dynamic Endpoint (DPDE) discovery plugin. *rtiddsgen* accepts the following options: - ``-example``: Generates type files, example files, and CMakelists files. - ``-language ``: Generates C or C++ code. - ``-namespace``: Enables C++ namespaces when the language option is C++. The generated example can then be compiled using `CMake `_ and the ``CMakelists.txt`` file generated by *Code Generator*. *Code Generator* also creates a ``README.txt`` file with a description of the example and instructions for how to compile and run it. Custom example .............. *Code Generator* can also generate examples using custom templates with the option ``-exampleTemplate ``. To generate an example using a custom template instead of the default one, run the following command: .. code-block:: console rtiddsgen -example -exampleTemplate