You are here: A Quick Introduction > Building and Running “Hello, World”

Building and Running “Hello, World”

Let’s start by compiling and running Hello World, a basic program that publishes information over the network.

For now, do not worry about understanding the code (we start covering it in Capabilities and Performance. Use the following instructions to run your first middleware program using Connext DDS.

Step 1: Set Up the Environment

There are a few things to take care of before you start working with the example code.

Set Up the Environment on Your Development Machine

  1. Set the NDDSHOME environment variable.
  2. Set the environment variable NDDSHOME to the Connext DDS install directory. (Connext DDS itself does not require that you set this environment variable. It is used in the scripts used to build and run the example code because it is a simple way to locate the install directory. You may or may not choose to use the same mechanism when you create scripts to build and/or run your own applications.)

    The default installation paths are described in Paths Mentioned in Documentation:

  1. Update your path.
  2. Add Connext DDS's bin directory to your path. This will allow you to run some of the simple command-line utilities included in your distribution without typing the full path to the executable.

  3. If you will be using the separate add-on product, Ada Language Support:
  4. Add $NDDSHOME/lib/gnat to your ADA_PROJECT_PATH environment variable. This directory contains Ada project files that will be used in the generated example project file.

    Make sure the Ada compiler, gprbuild, is in your path. The makefile used by the example assumes that gprbuild is in your path.

    On UNIX-based systems: ClosedAdd the path to gprbuild to your PATH environment variable.

  1. Make sure Java is available (only needed if you will be developing in Java).
  2. Ensure that appropriate java and javac executables are in your path. They can be found within the bin directory of your JDK installation. The Release Notes list the Java versions that are supported.

    On Linux systems: ClosedNote that GNU java (from the GNU Classpath project) is not supported—and will typically not work—but is in the path by default on many Linux systems.

  1. Make sure the preprocessor is available.
  2. Check whether the C preprocessor (e.g., cpp) is in your search path. This step is optional, but makes code generation with the rtiddsgen utility more convenient.Capabilities and Performance describes how to use rtiddsgen.

  1. Get your project files ready.

Set Up the Environment on Your Deployment Machine

Some configuration has to be done for the machine(s) on which you run your application; the RTI installer can’t do that for you, because those machines may or may not be the same as where you created and built the application.

  1. Make sure Java is available (only needed if you will be developing in Java).
  2. Ensure that appropriate java and javac executables are in your path. They can be found within the bin directory of your JDK installation. The Release Notes list the Java versions that are supported.

    On Linux systems: Note that GNU java (from the GNU Classpath project) is not supported—and will typically not work—but is in the path by default on many Linux systems.

  3. Make sure the dynamic libraries are available.

Step 2: Compile the Hello World Program

The same example code is provided in C, Traditional C++, C#, Java, and Ada4Ada support requires a separate add-on product, Ada Language Support. . The following instructions cover C++, Java, and Ada in detail; the procedures for C and C# are very similar. The same source code can be built and run on different architectures. Examples for the Modern C++ API are provided in the RTI Community portal.

By default, examples are copied into your home directory the first time you run RTI Launcher or any script in <NDDSHOME>/bin. This document refers to the location of the copied examples as <path to examples>.

Wherever you see <path to examples>, replace it with the appropriate path.

Default path to the examples:

Note: You can specify a different location for rti_workspace. You can also specify that you do not want the examples copied to the workspace.

The instructions also focus on Windows and UNIX-based systems. If you will be using an embedded platform, see the Embedded Systems Addendum for more instructions.

Step 3: Start the Subscriber

Step 4: Start the Publisher

Connext DDS interoperates across all of the programming languages it supports, so you can choose whether to run the publisher in the same language you chose for the subscriber or a different language.

 

Congratulations! You’ve run your first Connext DDS program!

© 2015 RTI