1

We previously built aws-sdk-cpp locally and designed a library around it. Now I'm upgrading to use Conan provided aws-sdk-cpp instead of a locally built one, but I'm getting errors from our library.

I call AWS functions such as the following,

std::string src_bucket;
DeleteObject
// ...

obj.WithBucket(src_bucket).WithDelete(std::move(del));

but I get errors like this.

error: no matching function for call to 'Aws::S3::Model::DeleteObjectsRequest::WithBucket(const string&)`.

Has this function call changed to now allow std::string? Is there a way to make AWS methods accept std::string?

1 Answer 1

2

Is there a way to make AWS methods accept std::string?

Yes. These functions accept std::string if custom memory management is disabled:

If the compile-time constant is enabled (on), the types resolve to STL types with a custom allocator connected to the AWS memory system.

If the compile-time constant is disabled (off), all Aws::* types resolve to the corresponding default std::* type.

It looks like the former is what you get, and the latter is what you expect - perhaps you've switched from linking the SDK statically (default off) to linking the SDK dynamically (default on)?

In any case, you'll either have to somehow build the SDK with custom memory management disabled, use types like Aws::String yourself, or convert between Aws::String and std::string as needed.

Sign up to request clarification or add additional context in comments.

2 Comments

The Conan library wasn't setting the BUILD_SHARED_LIBS CMake definition, even though the aws-sdk-cpp:shared Conan option was set to False.
Conan will probably be setting BUILD_SHARED_LIBS=ON only when aws-sdk-cpp:shared=True, as the opposite is the default, and is not expected to be set to OFF by the library CMakeLists.txt. I think the new CMakeToolchain integration sets it to OFF and ON based on the options.shared value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.