设置 AWS CPP SDK 时出现问题。 按照 hello_s3 示例。编译器抛出错误;
...include/aws/core/http/HttpClientFactory.h:60:123: error: no type named 'IOStreamFactory' in namespace 'Aws'
AWS_CORE_API std::shared_ptr<HttpRequest> CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory);
[build] ~~~~~^
#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;
}
#include <cstdlib>
。不确定如何纠正这个新设置中命名空间的错误?即使 cmake 中需要 c++11,Mac 上的 clang 也可以使用 c++98 进行编译吗?我收到类似的警告;warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
[build] virtual ~MemorySystemInterface() = default;
此代码定期在 Mac 上编译和测试,尚未出现此错误。 您是从源代码构建 SDK 吗?您如何构建示例?