AWS C++ SDK unresolved external "W" version of method

79 Views Asked by At

I'm using the AWS C++ SDK from a Visual Studio project. The SDK was installed using vcpkg. Building the project gives the following linker error:

LNK2001 unresolved external symbol "public: virtual class Aws::Utils::Outcome<class Aws::S3::Model::GetObjectResult,class Aws::S3::S3Error> __thiscall Aws::S3::S3Client::GetObjectW(class Aws::S3::Model::GetObjectRequest const &)const " (?GetObjectW@S3Client@S3@Aws@@UBE?AV?$Outcome@VGetObjectResult@Model@S3@Aws@@VS3Error@34@@Utils@3@ABVGetObjectRequest@Model@23@@Z)

The method used in the code is Aws::S3::S3Client::GetObject. This seems to be in the library installed by vcpkg, but the linker is looking for GetObjectW.

Why does it seem to be looking for a wide character version, and how do I correct this?

1

There are 1 best solutions below

0
On

This is a conflict with a Windows macro for an identically named Windows function, and has nothing to do with the AWS SDK. Undefining the macro before including the AWS headers solves this issue:

#undef GetObject
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
...