VR-Link API Documentation for HLA 1.3
3.1 - Compiling and Linking a VR-Link Application

Table of Contents

To build a VR-Link application, you must tell the compiler where to find the VR-Link header files (and for HLA, the RTI header files).

In addition, you must link with VR-Link's libraries (and for HLA, the RTI's libraries). If you are not using a C++ linker to link, you must explicitly link with C++ system libraries such as libC.so.

3.1.1 Libraries and Header Files

VR-Link consists of four libraries: mtl, vl, matrix, vlpi, and vlutil. The following versions of the vl library are provided:

Versions of the vl Library
Simulation standard UNIX Windows
HLA libvlHLA13.so, libvlHLA1516.so, libvlHLA1516e.so vlHLA13.lib, vlHLA1516.lib, vlHLA1516e.lib
DIS libvlDIS.so vlDIS.lib

On Windows:

3.1.1.1 Using Microsoft Visual C++ 8 Express Edition

Microsoft Visual C++ 8 Express Edition links against a different set of default libraries than Microsoft Visual Studio 2005 Professional does. Therefore, you might experience linking problems if you use Express Edition. If you have linking problems, add the following libraries to your link line:

3.1.2 Third-Party Libraries

VR-Link uses the third-party libraries libXml2, boost, and iconv. If you are building a VR-Link application, you must include them on your link line. The libXml2 library is part of the Red Hat Linux distribution. It is distributed with VR-Link for all other operating systems. For details about boost, please go to http://www.boost.org.

3.1.3 Compiling for a Particular Simulation Standard Under Linux

To build a VR-Link application for Linux using MAK's build system, you must use gmake 3.81 or later. You can download it from http://savannah.gnu.org/projects/make/

You can select DIS or HLA at compile time by using the flags described in the following sections. vlhome represents your VR-Link home directory.

3.1.3.1 HLA

After you install VR-Link, create a symbolic link called RTI in the top level VR-Link directory. Point the link to the RTI distribution that you are using.

Compile Flags

-I{VLHOME}/include (VR-Link headers)

-I{VLHOME}/RTI/include (path to MAK RTI include directory)

-DDtHLA=1 for conditional compilation)

-DDtHLA_1516=1 Use only if compiling for IEEE 1516 - 2000.

-DDtHLA_1516_EVOLVED=1 Use only if compiling for IEEE 1516 - 2010 (HLA Evolved).

Link Flags for HLA 1.3

-lvrhome/lib -lvl -lvlHLA13 -lmatrix -lmtl -lvlutil -lxml2 -lRTI-NG -lfedtime

Link Flags for HLA 1516

-Lvrhome/lib -lvl -lvlHLA1516 -lmatrix -lmtl -lvlutil -lxml2 -lrti1516 -lfedtime1516

Link Flags for HLA Evolved

-Lvrhome/lib -lvl -lvlHLA1516e -lmatrix -lmtl -lvlutil -lxml2 -lrti1516e -lfedtime1516e

3.1.3.2 DIS

The compile and link flags for DIS are:

Compile Flags

-Ivlhome/include (VR-Link headers)

-DDtDIS=1 (for conditional compilation)

Link Flags

-Lvlhome/lib -lvl -lmtl -lvlDIS -lmatrix -lvlutil -lxml2

3.1.4 Compiling for a Particular Protocol Version under Windows

Under Windows, you can set your program's protocol following the procedures in this section. You need to provide build settings in Microsoft Developer Studio to define constants and specify paths for header files and RTI libraries.

VR-Link includes project files for DIS and the three HLA versions. If you are building for HLA, make sure to point to the correct location of the RTI include and library directories. The default is to use the value in the MAK_RTIDIR environment variable.

Note
In addition to linking with netapi.lib and WS2_32.lib, you must link with comctl32.lib, libxml2.lib, iphlpapi.lib, and iconv.lib. For details, please see the sample project files.

3.1.4.1 When Compiling for HLA

  1. Choose Project -> Properties, then select the C/C++ folder.
  2. Enter the following #define symbols in the space provided for preprocessor definitions:

    DtHLA=1, DtHLA_1516=1, RTI_USES_STD_FSTREAM=1

  3. In the C/C++ -> General section, in the space provided for additional include libraries, enter your VR-Link include path and the path to your RTI include directory, for example:

    ../../include, "c:/MAK/MakRti4.0.1/include"

    or:

    $(MAK_VRLDIR)/include, $(MAK_RTIDIR)/include
    Note
    The relative pathnames in this procedure (for example, ../../include) are relative to the project .vcproj file in the ./examples/f18 directory of the default VR-Link installation. The full path would be similar to C://MAK/VR-Linkx.x/include.
  4. Select the Linker folder.
  5. In the Linker -> Input section, in the space provided for additional dependencies, enter the appropriate RTI, VR-Link and Visual C++ library files, for example:

    {libRTI-NG.lib | librti1516.lib | librti1516e.lib} {libfedtime.lib | libfedtime1516.lib | libfedtime1516e.lib} vl.lib vlutil.lib
    mtl.lib matrix.lib {vlHLA13.lib | vlHLA1516.lib | vlHLA1516e.lib} netapi32.lib WS2_32.lib comctl32.lib iphlpapi.lib
    libxml2.lib iconv.lib

    Also, make sure you list the appropriate paths to these files in the "Additional Library Directories" box in the Linker -> General section, for example:

    $(MAK_VRLDIR)/lib, $(MAK_RTIDIR)/lib

3.1.4.2 Compiling for DIS

  1. In the C/C++ -> General section, in the space provided for additional include libraries, enter your VR-Link include path, for example:

    ../../include

  2. In the Linker -> Input section, enter the appropriate VR-Link and Visual C++ library files, for example:

    vlutil.lib mtl.lib matrix.lib vl.lib vlDIS.lib netapi32.lib WS2_32.lib iphlpapi.lib comctl32.lib

    Also, make sure you list the appropriate paths to these files in the "Additional Library Directories" box in the Linker -> General section, for example:

    ../../lib

[Home] [Top of Page] [Using VR-Link from C >>]


Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)