当前位置: 首页 > news >正文

网站维护服务暴雪国服官网入口

网站维护服务,暴雪国服官网入口,天津怎样做网站推广,wordpress tag分类在本文中,我们将介绍如何编译AWS SDK C库,以便在您的项目中使用。AWS SDK C库提供了与Amazon Web Services交互的接口,允许您在C应用程序中使用AWS服务。 一、准备工作 在开始编译AWS SDK C库之前,请确保您的系统已经安装了以下…

在本文中,我们将介绍如何编译AWS SDK C++库,以便在您的项目中使用。AWS SDK C++库提供了与Amazon Web Services交互的接口,允许您在C++应用程序中使用AWS服务。

一、准备工作

在开始编译AWS SDK C++库之前,请确保您的系统已经安装了以下依赖项:
CMake(版本3.13或更高版本)
支持C++11的编译器(我是使用的是MSVC 2017 64位)

二、下载AWS SDK C++源代码

首先,您需要从GitHub上的AWS SDK C++存储库下载源代码。您可以通过以下命令克隆存储库:

git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp
cd aws-sdk-cpp

三、配置编译环境

接下来,您需要使用CMake来配置编译环境。这将生成适用于您的系统的构建文件。您可以通过以下命令来配置编译环境:

mkdir <BUILD_DIR>
cd <BUILD_DIR>
# 编译Release版本
cmake ..\aws-sdk-cpp -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3"
# 开始编译
cmake --build . --config=Release
# 安装到指定目录,需要管理员权限
cmake --install . --config=Release

cmake --install 会把库文件安装到 C:\Program Files\aws-cpp-sdk-all 目录

四、编译测试代码验证

4.1 创建hello_s3.cpp文件

#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <iostream>
#include <aws/core/auth/AWSCredentialsProviderChain.h>
using namespace Aws;
using namespace Aws::Auth;/**  A "Hello S3" starter application which initializes an Amazon Simple Storage Service (Amazon S3) client*  and lists the Amazon S3 buckets in the selected region.**  main function**  Usage: 'hello_s3'**/int main(int argc, char **argv) {Aws::SDKOptions options;// Optionally change the log level for debugging.
//   options.loggingOptions.logLevel = Utils::Logging::LogLevel::Debug;Aws::InitAPI(options); // Should only be called once.int result = 0;{Aws::Client::ClientConfiguration clientConfig;// Optional: Set to the AWS Region (overrides config file).// clientConfig.region = "us-east-1";// You don't normally have to test that you are authenticated. But the S3 service permits anonymous requests, thus the s3Client will return "success" and 0 buckets even if you are unauthenticated, which can be confusing to a new user. auto provider = Aws::MakeShared<DefaultAWSCredentialsProviderChain>("alloc-tag");auto creds = provider->GetAWSCredentials();if (creds.IsEmpty()) {std::cerr << "Failed authentication" << std::endl;}Aws::S3::S3Client s3Client(clientConfig);auto outcome = s3Client.ListBuckets();if (!outcome.IsSuccess()) {std::cerr << "Failed with error: " << outcome.GetError() << std::endl;result = 1;} else {std::cout << "Found " << outcome.GetResult().GetBuckets().size()<< " buckets\n";for (auto &bucket: outcome.GetResult().GetBuckets()) {std::cout << bucket.GetName() << std::endl;}}}Aws::ShutdownAPI(options); // Should only be called once.return result;
}

4.2 创建CmakeLists.txt

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.13)# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS s3)# Set this project's name.
project("hello_s3")# Set the C++ standard to use to build this target.
# At least C++ 11 is required for the AWS SDK for C++.
set(CMAKE_CXX_STANDARD 11)# Use the MSVC variable to determine if this is a Windows build.
set(WINDOWS_BUILD ${MSVC})if (WINDOWS_BUILD) # Set the location where CMake can find the installed libraries for the AWS SDK.string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif ()# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.# set(BIN_SUB_DIR "/Debug") # if you are building from the command line you may need to uncomment this# and set the proper subdirectory to the executables' location.AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR}${BIN_SUB_DIR})
endif ()add_executable(${PROJECT_NAME}hello_s3.cpp)target_link_libraries(${PROJECT_NAME}${AWSSDK_LINK_LIBRARIES})

4.3 使用cmake构建

mkdir my_project_build
cd my_project_build
cmake ../# 然后运行hello_s3
./hello_s3

hello_s3会打印出所有bucket名字,前提是已经配置了AWS的凭证。

在这里插入图片描述

http://www.sczhlp.com/news/119397/

相关文章:

  • 电子商务网站建设可运用的技术遵义公司网站搭建多少钱
  • 万江区网站建设公司wordpress包邮插件
  • 网站搭建素材群陈木胜老婆
  • 网站制作怎么报价关键词的选择网站提示
  • 网页设计网站结构图怎么弄江苏省建设工程集团
  • kettle从入门到精通 第108课 ETL之kettle 国产麒麟系统安装kettle教程
  • 部署 Squid 代理服务
  • k8s--etcd - 详解
  • 集安网站建设河北省城乡与建设厅网站
  • 用什么l软件做网站了seo 优化 服务
  • 广州市律师网站建设公司东莞人才市场招聘会时间
  • 在哪买网站链接临沂小程序开发公司哪家好
  • app网站开发的特点wordpress 访问量统计
  • 如果做网站接口江苏水利工程建设局网站
  • 厦门做手机网站公司摄影化妆艺术学校网站源码
  • 网站建设工作总结北京高级网站建设
  • 昆山网站制作公司品牌网站建设的要点
  • 建设网站要不要钱百度贴吧饥荒网站这么做
  • php 免费网站空间申请WordPress静态文件生成
  • 门户网站建设工作流程克隆wordpress
  • HBase 的自带命令行工具 hbase shell 的基本使用
  • 市场交易反心理特征之一:太过完美而不敢买入
  • 导购类网站模板工业设计网站哪个最好
  • 有做车身拉花的网站吗建设企业营销型网站
  • 女做受网站杭州开发网站的公司哪家好
  • 济南建设高端网站新浪云存储 wordpress
  • 简单的网站开发模板三字型网页布局图片
  • 3peak DCDC转换芯片选型列表
  • 重塑公司绩效管理的 6 种方法
  • 详细介绍:从“下山”到AI引擎:全面理解梯度下降(上)