I cloned aws-sdk-cpp from github and I managed to build it without problems (tests passed as well). I did not do "make install". I wanted to compile the dynamodbstreams part of the SDK exclusively, so I added -DBUILD_ONLY="dynamodbstreams" to the cmake parameters. I wrote a small test code, but it fails to compile because of the DescribeStreamOutcome type that is reported to be undefined ("inclomplete type"). However, it exists in the header file where it ought to be.
cmake version: 3.5.1, g++ version: 5.4.0 (I did not tried clang so far)
Could anyone please look at the codes and point out what's wrong?
I have the following code:
#include "aws/core/Aws.h"
#include "aws/dynamodbstreams/DynamoDBStreamsClient.h"
#include "aws/dynamodbstreams/model/DescribeStreamRequest.h"
int main()
{
Aws::SDKOptions options;
Aws::InitAPI(options);
Aws::DynamoDBStreams::DynamoDBStreamsClient client;
Aws::DynamoDBStreams::Model::DescribeStreamRequest request;
auto result = client.DescribeStream(request);
if (result.IsSuccess()) {}
Aws::ShutdownAPI(options);
return 0;
}
With this Makefile:
all: test
CFLAGS = -std=c++11 -Wall -fPIC \
-I$(SDK_SOURCE_DIR)/aws-cpp-sdk-core/include \
-I$(SDK_SOURCE_DIR)/aws-cpp-sdk-dynamodbstreams/include
LFLAGS = -shared -fPIC \
-L$(SDK_BUILD_DIR)/aws-cpp-sdk-core -laws-cpp-sdk-core \
-L$(SDK_BUILD_DIR)/aws-cpp-sdk-dynamodbstreams -laws-cpp-sdk-dynamodbstreams
test: test.o \
$(CXX) -shared -fPIC -o $@ $^
test.o: test.cc
$(CXX) $(CFLAGS) -c -o $@ $<
.PHONY: clean
clean:
rm -f *.o test
Upon making I get the following error:
g++ -std=c++11 -Wall -fPIC -I/home/attilacsabai/git-projects/aws-sdk-cpp/aws-cpp-sdk-core/include -I/home/attilacsabai/git-projects/aws-sdk-cpp/aws-cpp-sdk-dynamodbstreams/include -c -o test.o test.cc
test.cc: In function ‘int main()’:
test.cc:12:48: error: invalid use of incomplete type ‘Aws::DynamoDBStreams::Model::DescribeStreamOutcome {aka class Aws::Utils::Outcome<Aws::DynamoDBStreams::Model::DescribeStreamResult, Aws::Client::AWSError<Aws::DynamoDBStreams::DynamoDBStreamsErrors> >}’
auto result = client.DescribeStream(request);
^
In file included from /home/attilacsabai/git-projects/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/crypto/Hash.h:19:0,
from /home/attilacsabai/git-projects/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/AWSClient.h:23,
from /home/attilacsabai/git-projects/aws-sdk-cpp/aws-cpp-sdk-dynamodbstreams/include/aws/dynamodbstreams/DynamoDBStreamsClient.h:21,
from test.cc:2:
/home/attilacsabai/git-projects/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/crypto/HashResult.h:26:50: note: declaration of ‘Aws::DynamoDBStreams::Model::DescribeStreamOutcome {aka class Aws::Utils::Outcome<Aws::DynamoDBStreams::Model::DescribeStreamResult, Aws::Client::AWSError<Aws::DynamoDBStreams::DynamoDBStreamsErrors> >}’
template< typename R, typename E > class Outcome;
^
Makefile:16: recipe for target 'test.o' failed
make: *** [test.o] Error 1
However, DescribeStreamOutcome is defined in DynamoDBStreamsClient.h:
$ grep -i describestreamoutcome $SDK_SOURCE_DIR/aws-cpp-sdk-dynamodbstreams/include/aws/dynamodbstreams/DynamoDBStreamsClient.h | head -1
typedef Aws::Utils::Outcome<DescribeStreamResult, Aws::Client::AWSError<DynamoDBStreamsErrors>> DescribeStreamOutcome;
So could you please help me out? Thanks.