CPP REST static library

转载至https://stackoverflow.com/questions/44905708/statically-linking-casablanca-cpprest-sdk

OK, I pooled together a number of suggestions from the various threads and have the following set of steps in order to successfully link to the CPP REST static library:

  1. Download Casablanca SDK from https://github.com/Microsoft/cpprestsdk. (via GIT Clone or Zip).
  2. Open the VS solution and right-click on the properties of the cpprestsdk140.static.
  3. In the C++ -> Preprocessor definitions, add CPPREST_EXCLUDE_COMPRESSION. The full list looks like: _NO_ASYNCRTIMP;_ASYNCRT_EXPORT;_PPLX_EXPORT;WIN32;_MBCS;_USRDLL;CPPREST_EXCLUDE_COMPRESSION;%(PreprocessorDefinitions)
  4. In Librarian -> General -> Additional dependencies, add crypt32.lib;winhttp.lib; (See https://github.com/Microsoft/cpprestsdk/issues/344)
  5. Press OK, then build the cpprestsdk140.static project. You will end up with a libcpprest140d_2_9.lib (for Debug build) in the Binaries directory.

Now, in your own project:

  1. If you have previously used the Nuget version of CPPREST, firstly ensure you remove any references in the Nuget package manager.
  2. Right-click your project properties and go to C++ -> Additional Include Directories and enter the path for the CPPREST SDK include files. They currently reside in cpprestsdk\Release\include.
  3. Now go to C++ -> Preprocessor definitions, add _NO_ASYNCRTIMP (See https://github.com/Microsoft/cpprestsdk/issues/124).
  4. Go to Linker -> Input and add libcpprest140d_2_9.lib (along with pathname, if applicable). For the release version, it appears you also need to add crypt32.lib;winhttp.lib.
  5. Build your project and hopefully all is well ;)

I hope this helps someone (I'm sure it will)!

 

 

//或者

install-package cpprestsdk
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值