# Quickstart: Add C++ Agent to AUT

This page is meant as a quick reference only. You can find important details for each of these steps at [](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/c++-agent/go-agent-how-to-use/coverage-listener-mode-application-under-test "mention")

{% stepper %}
{% step %}

#### Download the Agent

See: [Downloading the C++ Agent](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/c++-agent/getting-started)
{% endstep %}

{% step %}

#### C++ Agent Configuration and BSID Generation

**Base Command:** `./SL.Agent.Cpp config [options]`

**Example Configurations:**

{% tabs %}
{% tab title="CLI" %}
**Example 1: Using parameters as CLI flags**

```
./SL.Agent.Cpp config \
  --token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  --appName="shopping-cart-service" \
  --branchName="feature-checkout" \
  --buildName="v1.2.3-build-456" \
  --labId="shoppingcart.dev.qa-blue" \
  --include="<source_folder_path>"
```

{% endtab %}

{% tab title="Environment variables" %}
**Example 2: Using environment variables**

```
export SL_APPNAME="shopping-cart-service"
export SL_BRANCHNAME="feature-checkout"
export SL_BUILDNAME="v1.2.3-build-456"
export SL_LABID="shoppingcart.dev.qa-blue"
export SL_INCLUDE="<source_folder_path>"

./SL.Agent.Cpp config
```

{% endtab %}

{% tab title="Configuration file" %}
**Example 3: Using settings.json configuration file**

```json
{
    "general": {
        "command": "run",
        "appName": "shopping-cart-service",
        "branchName": "feature-checkout",
        "buildName": "v1.2.3-build-456"
    },
    "session":{
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "LabId": "shoppingcart.dev.qa-blue"
    },
    "scan": {
        "binDir": "bin",
        "include": [
            "src/*.cpp,include/*.h,main.cpp"
        ]
    }
}
```

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

#### Scan and Instrument the Application Code

**Base Command:** `./SL.Agent.Cpp scan`

**Minimum Required Parameters for this command:**

* `--token` or `--tokenFile` - Your SeaLights authentication token or path to token file
* `--buildSessionIdFile` - Path to the `buildSessionId.txt` file generated by the `./SL.Agent.Cpp config` command
* `--binDir` - Path to the directory with **`.gcno`** files generated during compilation
* `--include` - Comma-separated list of files or patterns to include for scanning. Examples, `--include="src/*.cpp,include/*.h,main.cpp"` and `--inlude="*Core.cpp,mySrc.c??,Api*Client.cpp"`
  {% endstep %}

{% step %}

#### Run Unit Tests (Optional)

If you have unit tests, run them now using your normal test commands.
{% endstep %}

{% step %}

#### Deploy the Instrumented Application Code

**Base Command:** `LD_PRELOAD=<path_to_cpp_agent>/<corresponding_tracer_library> ./<your_application>`

| Platform         | Tracer Library                       |
| ---------------- | ------------------------------------ |
| Linux x86-64     | `libSL.Cpp.TracerLib.Linux_x64.so`   |
| Linux x86        | `libSL.Cpp.TracerLib.Linux_x86.so`   |
| Linux ARMv7      | `libSL.Cpp.TracerLib.Linux_armv7.so` |
| Linux ARM64      | `libSL.Cpp.TracerLib.Linux_arm64.so` |
| {% endstep %}    |                                      |
| {% endstepper %} |                                      |
