aws-doc-sdk-examples icon indicating copy to clipboard operation
aws-doc-sdk-examples copied to clipboard

example_code/s3/create_bucket.cpp:29:33: error: ‘config’ was not declared in this scope

Open jmichalik opened this issue 5 years ago • 1 comments

I'm trying to compile the cpp examples on Ubuntu 20.04 and get an error during the make. I didn't change anything. I set the ~/.aws/config and ~/.aws/credentials. I also tried with the export of the environmental variables. Any help is appreciated.

cmake output:

 cmake  ~/devel/various/aws-doc-sdk-examples/cpp/example_code/s3
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found AWS SDK for C++, Version: 1.8.128, Install Root:/usr/local, Platform Prefix:, Platform Dependent Libraries: pthread;crypto;ssl;z;curl
-- Components specified for AWSSDK: s3;sts, application will be depending on libs: aws-cpp-sdk-s3;aws-cpp-sdk-sts;aws-cpp-sdk-core
-- Try finding aws-cpp-sdk-core
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found aws-cpp-sdk-core
-- Try finding aws-cpp-sdk-sts
-- Found aws-cpp-sdk-sts
-- Try finding aws-cpp-sdk-s3
-- Found aws-cpp-sdk-s3
-- Configuring done
-- Generating done
-- Build files have been written to: /home/janusz/devel/various/aws-doc-sdk-examples/cpp/sdk_example_builds/s3

make output:

[  2%] Built target run_s3-demo
[  3%] Built target put_website_config
[  5%] Built target test_put_website_config
[  6%] Built target run_put_website_config
[  8%] Built target put_object_buffer
[  9%] Built target test_put_object_buffer
[ 10%] Built target put_object_async
[ 12%] Built target test_put_object_async
[ 13%] Built target run_put_object_async
[ 15%] Built target put_object
[ 16%] Built target test_put_object
[ 18%] Built target run_put_object
[ 19%] Built target put_bucket_policy
[ 21%] Built target list_objects_with_aws_global_region
[ 22%] Built target test_list_objects_with_aws_global_region
[ 24%] Built target test_put_bucket_policy
[ 25%] Built target list_objects
[ 27%] Built target list_buckets_disabling_dns_cache
[ 28%] Built target test_list_buckets_disabling_dns_cache
[ 30%] Built target run_list_buckets_disabling_dns_cache
[ 31%] Built target list_buckets
[ 33%] Built target test_list_buckets
[ 35%] Built target run_get_website_config
[ 36%] Built target s3-demo
[ 38%] Built target test_s3-demo
[ 40%] Built target run_get_acl
[ 42%] Built target run_get_put_object_acl
[ 44%] Built target get_website_config
[ 45%] Built target test_get_website_config
[ 47%] Built target run_copy_object
[ 49%] Built target run_list_objects_with_aws_global_region
[ 51%] Built target test_list_objects
[ 53%] Built target run_get_object
[ 55%] Built target get_bucket_policy
[ 56%] Built target test_get_bucket_policy
[ 57%] Built target get_put_object_acl
[ 58%] Built target run_get_put_bucket_acl
[ 59%] Built target run_delete_website_config
[ 60%] Built target run_list_objects
[ 61%] Built target copy_object
[ 63%] Built target test_copy_object
[ 64%] Built target delete_object
[ 66%] Built target test_delete_object
[ 67%] Built target run_list_buckets
[ 68%] Building CXX object CMakeFiles/run_create_bucket.dir/create_bucket.cpp.o
/home/janusz/devel/various/aws-doc-sdk-examples/cpp/example_code/s3/create_bucket.cpp: In function ‘bool AwsDoc::S3::CreateBucket(const String&, const Aws::S3::Model::BucketLocationConstraint&)’:
/home/janusz/devel/various/aws-doc-sdk-examples/cpp/example_code/s3/create_bucket.cpp:29:33: error: ‘config’ was not declared in this scope
   29 |     Aws::S3::S3Client s3_client(config);
      |                                 ^~~~~~
/home/janusz/devel/various/aws-doc-sdk-examples/cpp/example_code/s3/create_bucket.cpp:38:9: error: ‘request’ was not declared in this scope
   38 |         request.SetCreateBucketConfiguration(bucket_config);
      |         ^~~~~~~
/home/janusz/devel/various/aws-doc-sdk-examples/cpp/example_code/s3/create_bucket.cpp:42:32: error: ‘request’ was not declared in this scope
   42 |         s3_client.CreateBucket(request);
      |                                ^~~~~~~
make[2]: *** [CMakeFiles/run_create_bucket.dir/build.make:63: CMakeFiles/run_create_bucket.dir/create_bucket.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2043: CMakeFiles/run_create_bucket.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

jmichalik avatar Jan 27 '21 13:01 jmichalik

Hi, Could you please check https://github.com/awsdocs/aws-doc-sdk-examples/pull/1621

XsarfrazX avatar Jan 30 '21 10:01 XsarfrazX