Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How add a Crypto++ Library version 8.6 in Qt 6



  • Hi, for my project i need **Crypto++ Library**, but i don't understand how install it and connect it to Qt project.

    Other informations:



  • you link it to your Qt app. Do you use qmake or cmake to build your app?
    How and where do you install Crypto++?



  • @Alby If it is a new project I would recommend to create a CMake project. Then you can use vcpkg to install crypto++. vcpkg search cryptowill help to find the proper package (it is called cryptopp).
    After vcpkg install cryptopp it is installed on your machine and if you have followed the vcpkg setup guide it will be available to your cmake project after you have placed everything necessary in the CMake file.



  • @Alby You need to set CMAKE_TOOLCHAIN_FILE to the location where you have installed vcpkg and the support script. This can be done in Qt Creator via Projects/Build Settings. I added the following there for my app:
    -DCMAKE_TOOLCHAIN_FILE=<vcpkg_install_dir>\scripts\buildsystems\vcpkg.cmake
    This needs to be done for every build type.

    In your CMakeLists.txt you then need to add the following (at the correct places of course):
    find_package(cryptopp CONFIG REQUIRED)
    target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE cryptopp-static)

    That´s it.



  • @Alby Download binary and headers. In your .pro file add INCLUDEPATH, DEPENPATH and LIBS manually or as described in the manual.
    After that you can #include headers in your sources. If you do #include but QtCreator complains that file can't be found - you did the above wrong.


Log in to reply