aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

Undefined Reference Compilation Error When Using ImdsClient and ImdsClientConfig in C++ executable

Open saad-alsaad1 opened this issue 3 years ago • 0 comments

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: image

Reproduction Steps

The code is like below: image

I used the following includes: image

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

saad-alsaad1 avatar Jun 09 '22 15:06 saad-alsaad1