I am trying to run aws-sdk-cpp in Ubuntu by following the developer guide at https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/basic-use.html.
What I did are:
1. Install the sdk
sudo apt-get install cmake
sudo apt-get install uuid
sudo apt-get install libcurl4-openssl-dev
git clone https://github.com/aws/aws-sdk-cpp.git
cd aws-sdk-cpp
mkdir sdk_build
cd sdk_build
cmake3 .. -DBUILD_ONLY=s3
make
2. Create the test file test.cpp
#include <iostream>
#include <aws/core/Aws.h>
using namespace std;
int main(int argc, char** argv)
{
Aws::SDKOptions options;
Aws::InitAPI(options);
//use the sdk
Aws::ShutdownAPI(options);
cout << "Hello, World!";
return 0;
}
3. Compile
g++ -o test test.cpp
Then I got the error:
/tmp/ccAA9bE5.o: In function `main':
test.cpp:(.text+0x34): undefined reference to `Aws::InitAPI(Aws::SDKOptions const&)'
test.cpp:(.text+0x3c): undefined reference to `Aws::ShutdownAPI(Aws::SDKOptions const&)'
collect2: error: ld returned 1 exit status
My question:
How can I fix the issue in order to compile and run the aws-sdk-cpp? Did I miss any installation steps?
Thank you!