Build macOS C++ Command Line App With aws-sdk-c++

983 views Asked by At

I'm trying to understand the workflow for including the aws-sdk-c++ in a small example command line app in Xcode 8.3.3 (8E3004b) on macOS 10.12.6 (16G29). I've followed the directions posted here, and I can cmake, make, and make install fine. But, when I try to build the command line app in Xcode I get this error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:56:9: No member named 'clock_t' in the global namespace

Xcode gives me about 20 of these and gives up. I have my Header Search Paths set to $(SRCROOT)/test/include, recursive. It looks like Xcode can find the AWS SDK header files, but not the standard system header files. If I remove the path to the AWS SDK, the Xcode (obviously) can't find it and bails with one error.

I'm adding the .a libraries during the Link Binary With Libraries build phase, so I thought if I included the headers I'd be able to use them. I'm clearly not thinking about something right here, so any help would be appreciated.

The C++ file I'm trying to compile:

#include <iostream>
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/Bucket.h>


int main(int argc, char** argv)
{
    Aws::SDKOptions options;
    Aws::InitAPI(options);
    {
        Aws::S3::S3Client s3_client;
        auto outcome = s3_client.ListBuckets();

        if (outcome.IsSuccess()) {
            std::cout << "Your Amazon S3 buckets:" << std::endl;

            Aws::Vector<Aws::S3::Model::Bucket> bucket_list =
            outcome.GetResult().GetBuckets();

            for (auto const &bucket: bucket_list) {
                std::cout << "  * " << bucket.GetName() << std::endl;
            }
        } else {
            std::cout << "ListBuckets error: "
            << outcome.GetError().GetExceptionName() << " - "
            << outcome.GetError().GetMessage() << std::endl;
        }
    }
    Aws::ShutdownAPI(options);
}
1

There are 1 answers

0
Jon Buys On BEST ANSWER

I figured it out. I had to remove the recursive setting from /usr/local/include in the custom header search paths.

Now it compiles fine.