0

main.cpp: In function ‘void downloadFile(const string&, const string&, std::ostream&)’:

main.cpp:23:95: error: no matching function for call to ‘Aws::S3::S3Client::S3Client(Aws::Auth::AWSCredentials, Aws::Client::ClientConfiguration&)’ Aws::S3::S3Client s3Client(Aws::Auth::AWSCredentials(ACCESS_KEY, SECRET_KEY), clientConfig);

In file included from main.cpp:3:

install/include/aws/s3/S3Client.h:100:9: note: candidate: ‘Aws::S3::S3Client::S3Client(const std::shared_ptrAws::Auth::AWSCredentialsProvider&, const Aws::Client::ClientConfiguration&, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy, bool, Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION)’

S3Client(const std::shared_ptrAws::Auth::AWSCredentialsProvider& credentialsProvider, install/include/aws/s3/S3Client.h:100:9: note: candidate expects 5 arguments, 2 provided

#include <aws/lambda-runtime/runtime.h>
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/core/client/ClientConfiguration.h>
//#include <aws/core/auth/AWSCredentialsProvider.h>

using namespace aws::lambda_runtime;

Aws::SDKOptions options;

static const char* ENDPOINT_URL = "endpoint";
static const char* ACCESS_KEY = "accesskey";
static const char* SECRET_KEY = "secretkey";

void downloadFile(const std::string& bucketName, const std::string& objectKey, std::ostream& outputStream) {
    Aws::Client::ClientConfiguration clientConfig;
    clientConfig.endpointOverride = ENDPOINT_URL;
    clientConfig.scheme = Aws::Http::Scheme::HTTP;
    clientConfig.connectTimeoutMs = 30000;
    clientConfig.requestTimeoutMs = 30000;
    clientConfig.region = "us-west-2";

    Aws::S3::S3Client s3Client(Aws::Auth::AWSCredentials(ACCESS_KEY, SECRET_KEY), clientConfig);

}
user20208419
  • 121
  • 1
  • 11
  • 1
    Can you point your finger at the exact line in the shown code which `#include`s the header file that defines the `Aws::Auth::AWSCredentials` class, according to aws's documentation which, despite not knowing much about this library, I found with a simple keyword search? This is a trick question, this `#include` is missing. P.S. whether a "fully qualified" name is used, or not, is utterly irrelevant, "incomplete type" means the type is not defined, fully qualified or not. – Sam Varshavchik Sep 03 '23 at 01:22
  • @SamVarshavchik Thank you for your comment. I added AWSCredentials.h. But, I got no matching function for call to ‘Aws::S3::S3Client::S3Client(Aws::Auth::AWSCredentials, Aws::Client::ClientConfiguration&)’ – user20208419 Sep 03 '23 at 04:48
  • Do not understand, "candidate expects 5 arguments, 2 provided" – user20208419 Sep 03 '23 at 05:35

0 Answers0