Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetMessage() of AWSError class is hidden by Windows preprocessor statement #402

Closed
dkarantonis opened this issue Jan 5, 2017 · 3 comments

Comments

@dkarantonis
Copy link

Hi,

i am trying to use the following code:
std::cout << "Error while putting Object " << putObjectOutcome.GetError().GetExceptionName() << " " << putObjectOutcome.GetError().GetMessage() << std::endl;
to print a possible error after PutObjects fails, but GetMessage is hidden by system WinUser.h preprocessor statement:
#define GetMessage GetMessageW

In order for this to work, i have used the following workaround before calling AWSError GetMessage():
#undef GetMessage
and then the compiler recognizes the AWSError GetMessage() correctly.

Do you have any better solution to propose on this?

thanks,
Dimitris

@JonathanHenson
Copy link
Contributor

JonathanHenson commented Jan 5, 2017 via email

@dkarantonis
Copy link
Author

Ok, thanks!

@diablodale
Copy link
Contributor

For future searches and assist, a very similar issue exists, with similar fix, for GetObject

GetObject in the Aws::Utils::Outcome and Aws::S3::Model::GetObjectResult codepath can conflict with the GetObject macro that is loaded by windows.h (cascades to wingdi.h)

The workaround is the same: #undef GetObject

This is how my include appears:

#include <windows.h>
#undef GetMessage                       // workaround for AWSError method GetMessage()
#undef GetObject                        // workaround for Aws::S3::S3Client::GetObject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants