Developing C++ Programs on Windows

The GemFire C++ client uses the Visual Studio 2013 compiler for C++ programs on Windows, which invokes Microsoft® cl.exe from the command line at compile time.

The GemFire .NET client supports .NET 4.5.2 and Visual Studio 2013. Visual Studio 2013 is the recommended compiler. If you are using any other compiler, contact technical support for assistance.

Note: When compiling external projects or applications that are used or referenced by the client, make sure that you compile them for the same target architecture as your client installation. For example, if you installed the 32-bit (x86) version of the client, compile your external projects for 32-bit (x86) architecture.

Step 1. Set Up Environment Variables

After you have built the client libraries on Windows, perform these tasks:

  • Set the GEODE environment variable to product-dir, where product-dir is the path to the client product directory.
  • Add the %GEODE%\bin executable directory to the Windows PATH environment variable.

Step 2. Choose 32-bit or 64-bit Command-line Prompt

For 32-bit:

Start > Programs > Microsoft Visual Studio > 2013 > Visual Studio Tools > Visual Studio 2013 Command Prompt

For 64-bit:

Start > Programs > Microsoft Visual Studio 2013 > Visual Studio Tools > Visual Studio 2013 x64 Win64 Command Prompt

To build using the Microsoft Visual Studio Interface, from the Solutions Platform, choose Win32 or x86 from the Build menu for 32-bit builds or x64 for a 64-bit build.

The following table lists the compiler and linker switches that must be present on the cl.exe command line.

Note: If you want to use the Visual Studio user interface instead of invoking cl.exe from the command line, be sure to supply these parameters.

Argument Explanation
/MD Memory model.
/EHsc Catches C++ exceptions only and tells the compiler to assume that *extern* C functions never throw a C++ exception.
/GR Runtime type information.
-I%GEODE%\include Specifies the GemFire include directory.
%GEODE%\lib\pivotalgemfire.lib Specifies the library file for the shared library.
/D_CRT_SECURE_NO_DEPRECATE Suppresses warnings. Required for Visual Studio 2013.
/D_CRT_NON_CONFORMING_SWPRINTFS Suppresses warnings. Required for Visual Studio 2013.

Step 4. Verify that You Can Load the Client Library

Because GemFire does not provide a library that can be linked statically into an application on Windows, you must dynamically link to the client library.

To make the client library available for loading, verify that the directory product-dir/bin is included in the PATH environment variable, where product-dir is the path to the GemFire product directory.