After running this example, you'll see a message similar toSuccessfully created object ...followed by data specific to your object
and ending with a line that showsHello World!.
Clean up
To avoid incurring charges to your Google Cloud account for
the resources used on this page, delete the Google Cloud project with the
resources.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis guide details how to compile and run C++ client examples in Google Cloud Shell using micromamba and Conda.\u003c/p\u003e\n"],["\u003cp\u003eYou will start by activating Cloud Shell, creating or selecting a Google Cloud project, and setting up a Cloud Storage bucket.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves installing micromamba, creating a Conda environment with the required C++ development tools and libraries, and checking out the C++ client library source code.\u003c/p\u003e\n"],["\u003cp\u003eThe tutorial culminates in compiling and executing a "Storage Quickstart" example, followed by cleaning up the resources created, such as removing the object and bucket.\u003c/p\u003e\n"],["\u003cp\u003eFollowing the cleanup, it suggests exploring more C++ examples and deploying a C++ application to Cloud Run and Google Kubernetes Engine for further use.\u003c/p\u003e\n"]]],[],null,["# Quickstart: Run C++ Examples in Cloud Shell\n\nRun C++ Examples in Cloud Shell\n===============================\n\nLearn how to compile and run the C++ client examples in Cloud Shell using\n[micromamba](https://mamba.readthedocs.io/en/latest/micromamba-installation.html)\nand [Conda](https://conda.io/)\n\nBefore you begin\n----------------\n\n1. In the Google Cloud console, activate Cloud Shell.\n\n [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n2. [Create or select a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects).\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n - Create a Google Cloud project:\n\n ```\n gcloud projects create PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with a name for the Google Cloud project you are creating.\n - Select the Google Cloud project that you created:\n\n ```\n gcloud config set project PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project name.\n3. Create a Cloud Storage bucket: \n\n ```bash\n gcloud storage buckets create gs://BUCKET_NAME\n ```\n Replace \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e with a bucket name that meets the [bucket naming requirements](/storage/docs/buckets#naming).\n\n\u003cbr /\u003e\n\nInstall pre-compiled C++ Client Libraries in Cloud Shell\n--------------------------------------------------------\n\n1. In Cloud Shell, install `micromamba`:\n\n curl -fsSL https://micro.mamba.pm/api/micromamba/linux-64/latest | sudo tar -C /usr -xj bin/micromamba\n\n2. Add `micromamba` hooks to the current shell:\n\n eval \"$(/usr/bin/micromamba shell hook -s posix)\"\n\n3. Use `micromamba` to create a Conda environment with the necessary\n development tools and libraries:\n\n micromamba create -y -n base -c conda-forge cmake ninja cxx-compiler google-cloud-cpp libgoogle-cloud\n\n4. Activate the new conda environment:\n\n micromamba activate\n\nCheckout and compile the \"Storage Quickstart\" example\n-----------------------------------------------------\n\n1. Checkout the C++ Client Library source code, including the quickstart\n examples for all services:\n\n git clone --depth 1 https://github.com/googleapis/google-cloud-cpp\n\n2. Configure CMake to compile the \"Storage Quickstart\" example:\n\n cmake -S google-cloud-cpp/google/cloud/storage/quickstart -B .build\n\n3. Compile the example:\n\n cmake --build .build\n\n4. Run the example:\n\n .build/quickstart \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e\n\n5. After running this example, you'll see a message similar to\n `Successfully created object ...` followed by data specific to your object\n and ending with a line that shows `Hello World!`.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, delete the Google Cloud project with the\nresources.\n\n1. Delete the object created by the example:\n\n gcloud storage rm gs://\u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e/quickstart.txt\n\n2. Delete the bucket:\n\n gcloud storage buckets delete gs://\u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e\n\nWhat's next\n-----------\n\n- Find more [C++ examples](/docs/samples/?language=cpp).\n- Deploy a [C++ application](https://github.com/GoogleCloudPlatform/cpp-samples/tree/main/getting-started) to Cloud Run and Google Kubernetes Engine."]]