C/C++ SDK installation

3 minute read

Control feature rollout for certain user segments of your application with feature flags. To start using feature management in the platform, follow the instructions below to install the SDK and deploy a feature flag.

These same instructions are available in the platform UI. Select Installation from the left pane to use.

To install the SDK:

  1. Select Feature management  Installation.

  2. Select an Environment from the options, or create an environment by completing the following:

    1. Select CREATE ENVIRONMENT.

    2. Enter an Environment name.

    3. (Optional) Enter a Description.

    4. (Optional) Select Approvers if you want to have a manual approval required before deployment.

    5. (Optional) Enter any Properties you want to associate with the environment. For more information, refer to properties configuration and properties in an environment.

    6. Select SUBMIT.

  3. Select C/C++ client or C/C++, as appropriate, from the language options.

  4. Select a type of platform from the options.

  5. Follow the instructions specific to your operating system to add the ROX package to your application:

    Add the ROX package in Linux

    To add the ROX package in Linux:

    1. Install the prerequisites CMake, GCC, and Git with the following terminal command:

      apt-get install cmake gcc git
    2. Clone the Rox repository at the root of the workspace directory with the following terminal command:

      git clone https://github.com/rollout/rox-c.git
    3. Add the ROX package to your application with the following terminal command:

      cd rox-c && ./install.sh -d /path/to/install/dir (1)
      1 Replace /path/to/install/dir with your path to the installation directory.

    The SDK is now added to the specified subdirectory.

    Add the ROX package in macOS

    To add the ROX package in macOS:

    1. Install the prerequisites CMake, GCC, and Git with the following terminal command:

      brew install cmake gcc git
    2. Clone the Rox repository at the root of the workspace directory with the following terminal command:

      git clone https://github.com/rollout/rox-c.git
    3. Add the ROX package to your application with the following terminal command:

      cd rox-c && ./install.sh -d /path/to/install/dir (1)
      1 Replace /path/to/install/dir with your path to the installation directory.

    The SDK is now added in the specified subdirectory.

    Add the ROX package in Windows

    To add the ROX package in Windows:

    1. Install the following prerequisites and ensure the executables are added to your PATH:

    2. Open the Cross Tools Command Prompt for VS, and then clone the Rox repository with the following terminal command:

      git clone https://github.com/rollout/
    3. Navigate to the repository root directory, and then add the ROX package to your application at the desired installation path with the following terminal command:

      install %INSTALLATION_PATH% (1)
      1 Replace INSTALLATION_PATH with your path to the installation directory.
    4. (Optional) Add %INSTALLATION_PATH% to the system PATH variable.

    The SDK is now added to the specified subdirectory.

  6. Add the following code, as appropriate for your project, to import the SDK and create flags in your application:

    C
    C++
    #include <rox/client.h> #include <stdio.h> #define DEFAULT_API_KEY <YOUR-SDK-KEY> (1) #define DEFAULT_DEV_MODE_KEY "null" int main(int argc, char **argv) { RoxStringBase *demo_flag = rox_add_flag_with_freeze("demo.demoFlag", false, RoxFreezeUntilLaunch); RoxOptions *options = rox_options_create(); rox_options_set_dev_mode_key(options, DEFAULT_DEV_MODE_KEY); rox_setup(DEFAULT_API_KEY, options); char c = 'Y'; while (c != 'n' && c != 'N') { printf("Demo flag is %s\n", rox_flag_is_enabled(demo_flag) ? "ON" : "OFF"); printf("Continue? (Y/n):"); c = fgetc(stdin); if ((c == '\n' || c == EOF)) { // Enter key pressed c = 'Y'; } else { getchar(); // read dummy character to clear input buffer, which inserts after character input } printf("\n"); } rox_shutdown(); return 0; }
    #include <roxx/client.h> #include <cstdio> #define DEFAULT_API_KEY <YOUR-SDK-KEY> (1) #define DEFAULT_DEV_MODE_KEY "null" int main(int argc, char **argv) { Rox::Client::Flag *demoFlag = Rox::Client::Flag::Create("demo.demoFlag", false, RoxFreezeUntilLaunch); Rox::Options *options = Rox::OptionsBuilder() .SetDevModeKey(DEFAULT_DEV_MODE_KEY) .Build(); Rox::Setup(DEFAULT_API_KEY, options); char c = 'Y'; while (c != 'n' && c != 'N') { printf("Demo flag is %s\n", demoFlag->IsEnabled() ? "ON" : "OFF"); printf("Continue? (Y/n):"); c = fgetc(stdin); if ((c == '\n' || c == EOF)) { // Enter key pressed c = 'Y'; } else { getchar(); // read dummy character to clear input buffer, which inserts after character input } printf("\n"); } Rox::Shutdown(); return 0; }
    1 The platform provides the unique SDK key for your environment at the <YOUR-SDK-KEY> location within the Rox.setup call.
  7. Run your application and then select TEST INTEGRATION to confirm a successful connection.

After running the application, flags added in the code are automatically added to your feature flag list.

You have installed an SDK and created flags in your application.