-1

Having issues with GetObject. Intellisense in Visual Studio keeps evaluating the method as GetObjectW ...

unresolved external symbol "__declspec(dllimport) public: virtual class Aws::Utils::Outcome<class Aws::S3::Model::GetObjectResult,class Aws::Client::AWSError > __cdecl Aws::S3::S3Client::GetObjectW(class Aws::S3::Model::GetObjectRequest const &)const " (_imp?GetObjectW@S3Client@S3@Aws@@UEBA?AV?$Outcome@VGetObjectResult@Model@S3@Aws@@V?$AWSError@W4S3Errors@S3@Aws@@@Client@4@@Utils@3@AEBVGetObjectRequest@Model@23@@Z)

Here are my includes

#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/PutObjectRequest.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/s3/model/DeleteObjectRequest.h>
#include <aws/s3/model/GetBucketLocationRequest.h>
#include <aws/s3/model/ListObjectsRequest.h>

All other methods work. Put works, Delete Works, Lists work. it all works. the projects are set to VS 2017. I am ONLY having problems with GetObject and as I said intellisense sees every other method except GetObject which it evaluates to GetObjectW

Client::ClientConfiguration config;

config.region = Region::US_EAST_2;
config.scheme = Http::Scheme::HTTPS;
config.connectTimeoutMs = 30000;
config.requestTimeoutMs = 30000;

S3Client s3Client(Auth::AWSCredentials(ACCESS_KEY, SECRET_KEY), config);

GetObjectRequest getObjectRequest;
getObjectRequest.WithBucket(bucket)
  .WithKey(fileKey);

// //GetObject is Having issues here where it is not being found in referenced assembly it keeps being called GetObjectW... 
// //It is perhaps the case there is a missing required reference for the method?
GetObjectOutcome getObjectOutcome = s3Client.GetObject(getObjectRequest);
E_net4
  • 27,810
  • 13
  • 101
  • 139
Jessie Lulham
  • 110
  • 12

1 Answers1

0

resolved on https://github.com/aws/aws-sdk-cpp/issues/625

answer is:

must #undef GetObject before aws includes as follows:

#undef GetObject
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/GetObjectRequest.h>

This is a conflict with Windows.h

Jessie Lulham
  • 110
  • 12
  • I was just looking at the AWS C++ SDK source code, and I noticed the `#undef GetObject` when compiling on Windows is [officially included](https://github.com/aws/aws-sdk-cpp/blob/9c7584b/aws-cpp-sdk-s3/include/aws/s3/S3Client.h#L78-L83) in `S3Client.h`. – webninja Nov 26 '21 at 23:01