Integrating AWS S3 with Qt C++ (MSVC 2017 64 bit)
-
wrote on 28 Aug 2024, 10:22 last edited by viniltc
Hi everyone,
I'm currently working on integrating AWS S3 with a Qt C++ application on a Windows-based PC. I successfully built and installed the AWS SDK using CMake, and I created a small Qt desktop application to test the AWS S3 functionality. However, I'm running into linker errors, which I suspect might be related to the build process of the AWS SDK.
Has anyone here successfully integrated AWS S3 with a Qt C++ application on Windows? If so, could you share the CMake configuration you used to build the AWS SDK?
Here’s what I’ve done so far to build the AWS SDK:
cmake .. -G "Visual Studio 15 2017 Win64" -DBUILD_ONLY="s3;core;transfer" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\aws-sdk-cpp-install"
and in Qt
.pro
file I use something like this:QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 # Include path for AWS SDK headers INCLUDEPATH += C:/aws-sdk-cpp-install/include # Link against the AWS SDK libraries LIBS += -LC:/aws-sdk-cpp-install/lib \ -laws-cpp-sdk-s3 \ -laws-cpp-sdk-core \ -laws-crt-cpp \ -laws-checksums \ -laws-c-event-stream \ -laws-c-common \ -laws-c-io \ -laws-c-auth SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
I would appreciate any advice or tips on the best CMake configuration to use the library in Qt C++ (with compiler MSVC 2017 64 bit) on Windows environment or any additional steps needed to resolve these linker errors.
Thanks in advance for your help!
-
Hi,
Since you built the SDK statically, you have to ensure you pass the libraries in the correct order when linking to them.
1/2