Building libcurl with SSL support on Windows

前端 未结 10 2243
眼角桃花
眼角桃花 2020-11-27 12:12

I\'m using libcurl in a Win32 C++ application.

I have the curllib.vcproj project added to my solution and set my other projects to depend on it.

How do I bui

10条回答
  •  情歌与酒
    2020-11-27 12:26

    How to build libcurl C/C++ with OpenSSL (SSL support) on Windows

    1. Install libcurl
    2. Install OpenSSl
    3. Build libcurl with OpenSSL

    Installing libcurl

    Go to the download page of libcurl and donwnload the ZIP file under Source Archives. In my case it is called curl-7.58.0.zip

    Extract the archive and open projects/Windows/VC15/curl_all.sln with Visual Studio.

    Installing OpenSSL

    Download the windows binary of OpenSSL. In my case, I downloaded the windows installer file Win32 OpenSSL v1.1.0g from the Shining Light Productions distribution.

    The installation folder for me is C:\OpenSSL-Win32.

    Building libcurl with OpenSSL

    In the curl_all.sln Visual Studio solution file, change the build configuration to DLL Debug - DLL OpenSSL.

    In the Solution Explorer, right click the project curl and go to Properties.

    Under Linker -> General modify Additional Library Directories and add the path to your OpenSSL directory + \lib. In my case, this is C:\OpenSSL-Win32\lib.

    Apply and close the properties window.

    Right click the project libcurl and do the same as the previous step, add OpenSSL directory + \lib to Additional Library Directories under Linker -> General.

    Under C/C++ -> General, add C:\OpenSSL-Win32\include to the Additional Include Directories.

    Finally go to Linker -> Input and modify Additional Dependencies. Replace all the lib files to the following:

    ws2_32.lib
    wldap32.lib
    openssl.lib
    libssl.lib
    libcrypto.lib
    

    Apply and close the properties window.

    With the DLL Debug - DLL OpenSSL build configuration still selected, go to Build -> Build Solution.

    Copy the two dll files libcrypto-1_1.dll and libssl-1_1.dll from the OpenSSL bin directory (C:\OpenSSL-Win32\bin) to the just created build directory curl-7.58.0\build\Win32\VC15\DLL Debug - DLL OpenSSL.

    Validating Build

    Inside the build directory, run curld.exe. If it runs with no errors (missing dll, etc.) then your build was successful.

提交回复
热议问题