The C++ SDK is a tool available as part of the Gemini Enterprise Agent Platform Vision SDK. You can use the
C++ SDK to programmatically manage, control, and perform different forms of
I/O with Gemini Enterprise Agent Platform Vision.

This page describes how to use the C++ SDK to build and test.

## Before you begin

- Complete the steps to [set up your Google Cloud project](https://docs.cloud.google.com/vision-ai/docs/cloud-environment.md.txt).
- Review [system requirements](https://docs.cloud.google.com/vision-ai/docs/cloud-environment.md.txt#cpp-supported-platforms) before trying to use the C++ SDK.
- Get the Gemini Enterprise Agent Platform Vision SDK source code from the publicly available
  [GitHub](https://github.com/google/visionai) repository:

  ```c++
  git clone https://github.com/google/visionai.git
  ```

  The C++ public SDK is located in `visionai/public/streams.h`. For reference
  information, see the [reference documentation](https://docs.cloud.google.com/vision-ai/docs/reference/cpp.md.txt).
- Install any [system dependencies](https://docs.cloud.google.com/vision-ai/docs/cloud-environment.md.txt#cpp-system-deps) you might need.

- Use the [create streams and ingest data](https://docs.cloud.google.com/vision-ai/docs/create-manage-streams.md.txt) topic to
  create stream resources to use in the following code samples.

## Build and test programs

The following example shows you how to use the C++ programming SDK to build
your own programs. The sample shows this process directly by walking through
an example for sending and receiving [`Packets`](https://docs.cloud.google.com/vision-ai/docs/reference/cpp/group/packet.md.txt).

These instructions show you how to build two simple programs. The first program
sends messages at regular intervals, while the second program receives the
messages that the first program sends. You can use these programs as a starting
point to build your own custom applications with the C++ SDK.

1. Go to the root of the source code directory.

   The contents of the directory resemble the following:

   ```c++
   bazel  BUILD  CONTRIBUTING.md  debian  deps.bzl  LICENSE  README.md  third_party  visionai [...]
   ```
2. Optional: Read the tutorial source code instructions.

   **Sender app:**

   ```c++
   cat visionai/public/tutorial/sender_app.cc
   ```

   **Receiver app:**

   ```c++
   cat visionai/public/tutorial/receiver_app.cc
   ```
3. Build the sender and receiver apps.

   ```c++
   bazel build //visionai/public/tutorial/...
   ```
4. Verify the build worked. In one terminal, run the following command for the
   sender app. Replace the following:

   - <var translate="no">PROJECT_ID</var>: Your project ID.
   - <var translate="no">LOCATION_ID</var>: Your location ID. For example, `us-central1`. [Supported regions](https://docs.cloud.google.com/vision-ai/docs/warehouse-supported-regions.md.txt). [More information](https://docs.cloud.google.com/about/locations).
   - <var translate="no">STREAM_ID</var>: The stream ID that you created in the cluster. For example, `input-1`.

   ```
   ./bazel-bin/visionai/public/tutorial/sender_app \
   --service_endpoint visionai.googleapis.com \
   --project_id PROJECT_ID \
   --location_id LOCATION_ID \
   --cluster_id application-cluster-0 \
   --stream_id STREAM_ID
   ```
5. In a different terminal, run the following command for the
   receiver app. Replace the following:

   - <var translate="no">PROJECT_ID</var>: Your project ID.
   - <var translate="no">LOCATION_ID</var>: Your location ID. For example, `us-central1`. [Supported regions](https://docs.cloud.google.com/vision-ai/docs/warehouse-supported-regions.md.txt). [More information](https://docs.cloud.google.com/about/locations).
   - <var translate="no">STREAM_ID</var>: The stream ID that you created in the cluster. For example, `input-1`.

   ```
   ./bazel-bin/visionai/public/tutorial/receiver_app \
   --service_endpoint visionai.googleapis.com \
   --project_id PROJECT_ID \
   --location_id LOCATION_ID \
   --cluster_id application-cluster-0 \
   --stream_id STREAM_ID
   ```

## What's next

- Read about processing components you can add to an app in [Build an app](https://docs.cloud.google.com/vision-ai/docs/build-app.md.txt).
- Learn about output storage and processing options in [Connect app output to a data destination](https://docs.cloud.google.com/vision-ai/docs/connect-data-destination.md.txt).
- Read about how to [Search Warehouse data in the console](https://docs.cloud.google.com/vision-ai/docs/search-streaming-warehouse.md.txt).