Search code examples
c++static-librariescasablancacpprest-sdkvcpkg

how to use static build of cpprest-sdk generated by vcpkg?


I want to use cpprestsdk as static library for my project, I used the vcpkg tool to get the static library by entering the command: vcpkg install cpprestsdk:x86-windows-static, I have the following lib files under my installed directory in vcpkg folder, I was wondering If I want to link my application to cpprestsdk I only need to link it with the resulting cpprest_2_10.lib? or I should add all the other libs?

enter image description here


Solution

  • Yeah, you don't need all those libraries, mostly you just need cpprest_2_10.lib

    I did the following with success: vcpkg install --triplet x64-windows-static-md cpprestsdk I then linked these files: zlib.lib cpprest_2_10.lib

    I also learned, from this issue (https://github.com/Microsoft/vcpkg/issues/996) that you must also link to: crypt32.lib bcrypt.lib winhttp.lib

    And use this preprocessor definition: _NO_ASYNCRTIMP=1