C++ AWSCredentials : undefined reference to `Aws::Free(void*)'

c++ amazon-web-services

208 просмотра

1 ответ

4667 Репутация автора

I am learning C++ by reading Stroustrup's book and I am practicing on some work related code.

I need to write some small code for calling the Amazon Simple Systems Manager (which if I were to do it python would take about 5 min, but this is for learning).

The first thing I need to do is create a credentials object with the Access and Secret keys. This is proving harder than I thought!

#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
char const* AWS_ACCESS_KEY_ID = "aaaaaaa";
char const* AWS_SECRET_ACCESS_KEY = "bbbbb";


But I am getting the following error:

In function `Aws::Allocator<char>::deallocate(char*, unsigned long)':
main.cpp: undefined reference to `Aws::Free(void*)'

Best I can figure is this is a problem with how the Aws::String is supposed to work?

According to the docs it's typedef std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > >

I looked at basic_string and that's just the standard library string, beyond that I am lost.

Автор: Sam Hammamy Источник Размещён: 08.11.2017 11:27

Ответы (1)

1 плюс

23893 Репутация автора


Here are the headers that I include for simple programs to test credentials using the Amazon C++ SDK:

#include <stdio.h>
#include <tchar.h>
#include <aws/core/Aws.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/logging/DefaultLogSystem.h>
#include <aws/core/utils/logging/AWSLogging.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/core/auth/AWSCredentialsProviderChain.h>

In your linker include the aws-cpp-sdk-core.lib library.

Note: I am using Visual Studio to build my projects.

Автор: John Hanley Размещён: 08.11.2017 11:39
Вопросы из категории :