Menu
AWS SDK for C++
Developer Guide

Setting Up the AWS SDK for C++

This section presents information about how to setup the AWS SDK for C++ on your development platform.

Prerequisites

To use the AWS SDK for C++, you need:

  • Visual Studio 2013 or later

    Note

    Visual Studio 2013 doesn't provide default move constructors and operators. Later versions of Visual Studio provide a standards-compliant compiler.

  • or GNU Compiler Collection (GCC) 4.9 or later

  • or Clang 3.3 or later

  • A minimum of 4 GB of RAM

    Note

    You need 4 GB of RAM to build some of the larger AWS clients. The SDK might fail to build on Amazon EC2 instance types t2.micro, t2.small, and other small instance types due to insufficient memory.

Additional Requirements for Linux Systems

To compile on Linux, you must have the header files (-dev packages) for libcurl, libopenssl, libuuid, zlib, and optionally, libpulse for Amazon Polly support. Typically, you'll find the packages in your system's package manager.

To install these packages on Debian/Ubuntu-based systems

Copy
sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev

To install these packages on Redhat/Fedora-based systems

Copy
sudo dnf install libcurl-devel openssl-devel libuuid-devel pulseaudio-devel

Getting the SDK Using NuGet with Visual C++

You can use NuGet to manage dependencies for AWS SDK for C++ projects that you develop with Microsoft Visual C++. To use this procedure, you must have NuGet installed on your system.

To use the SDK with NuGet

  1. Open your project in Visual Studio.

  2. In Solution Explorer, right-click your project name, and then choose Manage NuGet Packages.

  3. Select the packages to use by searching for a particular service or library name. For example, you could use a search term such as aws s3 native. Or, because AWS SDK for C++ libraries are named consistently, use AWSSDKCPP-service name to add a library for a particular service to your project.

  4. Choose Install to install the libraries and add them to your project.

When you build your project, the correct binaries are automatically included for each runtime/architecture configuration you use—you won't need to manage these dependencies yourself.

Getting the SDK Using Vcpkg with Visual C++

You can use vcpkg to manage dependencies for AWS SDK for C++ projects that you develop with Microsoft Visual C++. To use this procedure, you must have vcpkg installed on your system.

To use the SDK with vcpkg

  1. Open a Windows command prompt and navigate to the vcpkg directory.

  2. Integrate vcpkg into Visual Studio. You can integrate per project or per user (shown below) to avoid manually editing Visual C++ directory paths.:

    Copy
    vcpkg integrate install
  3. Install the AWS SDK for C++ package. This package compiles the SDK and its dependencies. It can take awhile.:

    Copy
    vcpkg install aws-sdk-cpp:x86-windows
  4. Open your project in Visual Studio.

  5. #include AWS SDK for C++ header files you want in your source code.

Like NuGet, when you build your project, the correct binaries are automatically included for each runtime/architecture configuration you use.

Building the SDK from Source

If you don't use Visual Studio (or don't want to use NuGet), you can build the SDK from source to set it up for your development system. This method also enables you to customize your SDK build—see CMake Parameters for the available options.

To build the SDK from source

  1. Download or clone the SDK source from aws/aws-sdk-cpp on GitHub.

    • Direct download: aws/aws-sdk-cpp/archive/master.zip

    • Clone with Git:

      HTTPSSSH
      HTTPS
      Copy
      git clone https://github.com/aws/aws-sdk-cpp.git
      SSH
      Copy
      git clone git@github.com:aws/aws-sdk-cpp.git
  2. Install cmake (v3.0+) and the relevant build tools for your platform. Ensure these are available in your PATH. If you're unable to install cmake , you can use make or msbuild .

  3. Create a directory in which to create your buildfiles, and generate the necessary buildfiles within it. This is the recommended approach, referred to as an out-of-source build.:

    Copy
    mkdir sdk_build cd sdk_build cmake <path/to/sdk/source>

    Alternatively, create the build files directly in the SDK source directory.:

    Copy
    cd <path/to/sdk/source> cmake .

    If you don't have cmake installed, you can use these alternative commands to set up your build directory:

    auto makeVisual Studio
    auto make
    Copy
    make
    Visual Studio
    Copy
    msbuild ALL_BUILD.vcxproj
  4. Build and install the SDK by typing one of the following in the same location where you generated your build files:

    auto makeVisual Studio
    auto make
    Copy
    make sudo make install
    Visual Studio
    Copy
    msbuild INSTALL.vcxproj

Note

Building the entire SDK can take awhile. To build only a particular client, such as Amazon S3, you can use the cmake BUILD_ONLY parameter. For example:

Copy
cmake -DBUILD_ONLY="s3"

See CMake Parameters for more ways to modify the build output.

Building for Android

To build for Android, add -DTARGET_ARCH=ANDROID to your cmake command line. The AWS SDK for C++ includes a cmake toolchain file that should cover what's needed, assuming you've set the appropriate environment variables (ANDROID_NDK).

Android on Windows

Building for Android on Windows requires additional setup. In particular, you have to run cmake from a Visual Studio (2013 or later) developer command prompt. You'll also need the commands git and patch in your path. If you have git installed on a Windows system, you'll most likely find patch in a sibling directory (.../Git/usr/bin/). Once you've verified these requirements, your cmake command line will change slightly to use nmake .:

Copy
cmake -G "NMake Makefiles" `-DTARGET_ARCH=ANDROID` <other options> ..

nmake builds targets in serially. To make things go more quickly, we recommend installing JOM as an alternative to nmake , and then changing the cmake invocation as follows.:

Copy
cmake -G "NMake Makefiles JOM" `-DTARGET_ARCH=ANDROID` <other options> ..

Creating Release Builds

auto makeVisual Studio
auto make
Copy
cmake -DCMAKE_BUILD_TYPE=Release <path/to/sdk/source> make sudo make install
Visual Studio
Copy
cmake <path-to-root-of-this-source-code> -G "Visual Studio 12 Win64" msbuild INSTALL.vcxproj /p:Configuration=Release

Running Integration Tests

Several directories are appended with *integration-tests. After you build your project, you can run these executables to ensure everything works correctly.