Construct build error for MakeShared in AWS S3 SDK

huangapple go评论69阅读模式
英文:

Construct build error for MakeShared in AWS S3 SDK

问题

AWS SDK CPP连接/授权S3时的构造函数错误(Xcode)

我在使用MakeShared构造函数时遇到了错误。AWS文档并未明确说明原因。

英文:

AWS SDK CPP constructor error when trying to connect/auth with S3 (Xcode)

I am getting error an on the MakeShared constructor. The AWS documentation isn’t really shining a light as to why.

Showing Recent Messages

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/allocator_traits.h:298:9: No matching function for call to 'construct_at'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:292:37: In instantiation of function template specialization 'std::allocator_traits<std::allocator<Aws::S3::S3Client>>::construct<Aws::S3::S3Client, std::shared_ptr<SimplifiedAWSCredentialsProvider> &, Aws::Client::ClientConfiguration &, void, void>' requested here
PTUploader::PTUploader(const std::string& access_key, const std::string& secret_key, const std::string& region)
    : access_key_(access_key),
      secret_key_(secret_key),
      region_(region)
{
    // Initialize the SDK
    options_.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug;
    Aws::Utils::Logging::InitializeAWSLogging(
        Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>(
            "RunUnitTests", Aws::Utils::Logging::LogLevel::Debug, "aws_sdk_"));
    Aws::InitAPI(options_);

    Aws::Client::ClientConfiguration config;
    config.region = region_;

    // Create credentials
    auto credentialsProvider = std::make_shared<SimplifiedAWSCredentialsProvider>(access_key_, secret_key_);

    // Create S3 client with credentials and config
    s3_client_ = std::make_shared<Aws::S3::S3Client>(credentialsProvider, config);
}

答案1

得分: 1

已修复,SDK与C++20不兼容,切换编译器为GNU++17。

英文:

Fixed, SDK not compat with C++20, switched compiler to GNU++17

huangapple
  • 本文由 发表于 2023年5月21日 07:37:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76297745.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定