aws-sdk-cpp
aws-sdk-cpp copied to clipboard
Undefined Reference Compilation Error When Using ImdsClient and ImdsClientConfig in C++ executable
Describe the bug
I've compiled all AWS SDK packages, linked the libraries (*.so and *.a files) to my executable, and included all *.h files. In my executable, I use many AWS classes. But when I use ImdsClient and ImdsClientConfig in my code. I get an undefined reference error when compiling the executable.
Expected Behavior
I think including ImdsClient and ImdsClientConfig should work other includes (EventLoopGroup, ListInstanceProfilesRequest, EC2MetadataClient... etc).
Current Behavior
Error screenshot:

Reproduction Steps
The code is like below:

I used the following includes:

The steps used for compilation are:
1- git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp
2- cd aws-sdk-cpp
3- git checkout main
4- git pull origin main
5- git submodule update --init --recursive
6- cmake aws-sdk-cpp -DCMAKE_BUILD_TYPE=Release -DCURL_INCLUDE_DIR=/usr/include/ -DCMAKE_PREFIX_PATH=./aws-sdk-libs -DBUILD_SHARED_LIBS=ON
7- make
8- make install
9- then I included the include folder and linked the lib64 folder to the executable.
Possible Solution
I think something wrong with linking ImdsClient to a .so file.
Additional Information/Context
No response
AWS CPP SDK version used
1.9.274
Compiler and Version used
gcc (GCC) 4.8.5 20150623
Operating System and version
Red Hat 7