cURL with Visual Studio 2013

前端 未结 2 890
说谎
说谎 2020-12-08 18:04

So i have came along with cURL as a very nice library and working very fine in OSX. But on windows now i have got big troubles with getting ready with this library. I googl

2条回答
  •  情话喂你
    2020-12-08 18:26

    Had problems myself, finally got it working now. I downloaded curl-7.42.1.zip from the official website. Within the archive you'll find the source code and winbuild/BUILD.WINDOWS.txt, which basically contains the instructions I followed. I'll assume that it has been unzipped to C:\curl-7.42.1.

    Open the Visual Studio command prompt located at

    C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts

    This automatically sets the environment variables needed to use Visual Studio tools like the compiler. Then move to the winbuild directory and call

    nmake /f Makefile.vc mode=dll

    as described in the text file I mentioned above.

    That will create the directory

    C:\curl-7.42.1\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl

    containing libcurl.dll, libcurl.lib and the necessary header files. Let's rename it to C:\curl-7.42.1\builds\release :'D

    1. Then open your project.
    2. Open your project's properties.
    3. Make sure you choose Release as configuration (top left corner)!
    4. Navigate to VC++ Directories > Include directories and add C:\curl-7.42.1\builds\release\include
    5. Add C:\curl-7.42.1\builds\release\lib to VC++ Directories > Library directories.
    6. Go to Linker > Input > Additional Dependencies and add libcurl.lib.
    7. Finally copy C:\curl-7.42.1\builds\release\bin\libcurl.dll to your project folder.

    That should do the trick! :D If you want to use cURL in debug mode, you can do almost the same, recompile using nmake /f Makefile.vc mode=dll debug=yes, go to your project's properties, add the newly created directory paths (changing libcurl.lib to libcurl_debug.lib) and you should be done.

提交回复
热议问题