# tencentcloud-sdk-cpp-intl-en **Repository Path**: tencentcloud/tencentcloud-sdk-cpp-intl-en ## Basic Information - **Project Name**: tencentcloud-sdk-cpp-intl-en - **Description**: Tencent Cloud API 3.0 SDK for C++ - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-08-30 - **Last Updated**: 2025-07-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Introduction * Welcome to Tencent Cloud Software Development Kit (SDK) 3.0, a companion tool for TencentCloud API 3.0. * This document introduces Tencent Cloud SDK for C++ to help C++ developers debug and integrate TencentCloud APIs. If you are using Tencent Cloud SDK for C++ for the first time, you can follow the sample code provided in this document. ## Environmental Dependencies ### Preparation 1. Activate a desired product in the Tencent Cloud Console. 2. Get the SecretID, SecretKey, and endpoint for calling the API of the product. An endpoint is typically in the format of \*.intl.tencentcloudapi.com. For example, the endpoint for calling the API of CVM is cvm.intl.tencentcloudapi.com. For more information, please see the documentation of the specified product. ### Compiler * Supports C++ 11 or later versions: GCC 4.8 or later. * Only supports the Linux operating system, not Windows. ### Compilation tool - [cmake](https://cmake.org/) Install CMake 3.0 or later. Examples: ``` In Ubuntu, run the following command: sudo apt-get install cmake In CentOS, run the following command: yum install cmake3 ``` ### Dependent library - [libcurl](https://curl.haxx.se/libcurl/) Samples: ``` In Ubuntu, run the following command: sudo apt-get install libcurl4-openssl-dev In CentOS, run the following command: yum install libcurl-devel ``` Note: we recommend that you install the latest version of the libcurl library to avoid memory leaks in the libcurl library. - [openssl](https://www.openssl.org/) Samples: ``` In Ubuntu, run the following command: sudo apt-get install libssl-dev In CentOS, run the following command: yum install openssl-devel ``` - libuuid Samples: ``` In Ubuntu, run the following command: sudo apt-get install uuid-dev In CentOS, run the following command: yum install libuuid-devel ``` ## SDK build from source code 1. Go to the [GitHub code hosting page](https://github.com/tencentcloud/tencentcloud-sdk-cpp-intl-en) to download the latest source code package. 2. Go to the directory where the SDK package is stored and create necessary build files. ``` cd mkdir sdk_build cd sdk_build cmake .. make sudo make install ``` ## Samples of Using Tencent Cloud SDK for C++ The following code samples describe how to call the `DescribeInstances` API of CVM. ### Simplified code ```c++ #include #include #include #include #include #include #include #include using namespace TencentCloud; using namespace TencentCloud::Cvm::V20170312; using namespace TencentCloud::Cvm::V20170312::Model; using namespace std; int main() { TencentCloud::InitAPI(); string secretId = ""; string secretKey = ""; Credential cred = Credential(secretId, secretKey); DescribeInstancesRequest req = DescribeInstancesRequest(); CvmClient cvm_client = CvmClient(cred, "ap-guangzhou"); auto outcome = cvm_client.DescribeInstances(req); if (!outcome.IsSuccess()) { cout << outcome.GetError().PrintAll() << endl; TencentCloud::ShutdownAPI(); return -1; } DescribeInstancesResponse rsp = outcome.GetResult(); cout<<"RequestId="<"; string secretKey = ""; Credential cred = Credential(secretId, secretKey); // (Optional) Instantiate an HTTP option. HttpProfile httpProfile = HttpProfile(); httpProfile.SetKeepAlive(true); // Specify whether to enable the keepalive feature. The default value is false. httpProfile.SetEndpoint("cvm.intl.tencentcloudapi.com"); httpProfile.SetReqTimeout(30); // Specify the request timeout value, in seconds. The default value is 60s. httpProfile.SetConnectTimeout(30); // Specify the response timeout value, in seconds. The default value is 60s. ClientProfile clientProfile = ClientProfile(httpProfile); DescribeInstancesRequest req = DescribeInstancesRequest(); req.SetOffset(0); req.SetLimit(5); CvmClient cvm_client = CvmClient(cred, "ap-guangzhou", clientProfile); // set proxy. // NetworkProxy proxy = NetworkProxy(NetworkProxy::Type::HTTP, "localhost.proxy.com", 8080); // cvm_client.SetNetworkProxy(proxy); auto outcome = cvm_client.DescribeInstances(req); if (!outcome.IsSuccess()) { cout << outcome.GetError().PrintAll() << endl; TencentCloud::ShutdownAPI(); return -1; } DescribeInstancesResponse rsp = outcome.GetResult(); cout<<"RequestId="<