windows 下编译libcurl

因为linux平台采用了libcurl,有一个程序移植到到windows平台,再linux采用libcurl。在windows下准备也采用该库。在网上搜索了几位同行写的,步骤写的都不是太清楚,导致我走了不少弯路。

本文将以详细的步骤,介绍libcurl的编译。

下面是步骤:

1. 下载源代码,直接从github上clone仓库,就可以了。

     git clone https://github.com/curl/curl.git

2. 选择版本

    我采用了版本: 7.56.0 (tag)

3.  生成工程

    执行curl/projects文件下generate.bat,生成一个windows文件,文件夹下面有VS的工程,我选择的VS14。

    windows 下编译libcurl

  4.   打开curl-all.sln工程

  windows 下编译libcurl

5.  选择编译的项目:

   windows 下编译libcurl

6. 我们不需要OpenSSL 和 SSH2 两个库,我选择LIB Release执行,执行成功了。

    windows 下编译libcurl

7. 编译支持ssl的库,再projects中有一个ReadMe.txt,我们打开看一下。

The projects files also support build configurations that require third party dependencies such as OpenSSL, wolfSSL and SSH2. If you wish to support these, you will also need to download and compile those libraries as well.

如果需要支持他们,需要download这些特性呢,需要安装并且编译这些库。文件的目录结构如下:

windows 下编译libcurl

8.  我们接下来去github下载openssl 和 ssh2吧。注意,目录结构要和curl在同一个文件夹下面。(github的服务器在老外,估计有时候下载速度有点慢,如果碰到了很慢的情况,耐心等待一会。喝茶中....)

       git clone https://github.com/openssl/openssl.git

              git clone https://github.com/libssh2/libssh2.git

 

相关推荐